Core/PacketIO: Updated packet structures to 8.1.5
Port TrinityCore Commit: https://github.com/TrinityCore/TrinityCore/commit/31fda79556e55375962a3c9e46f6dbdbf6e90d18
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Network.Packets;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
public partial class WorldSession
|
||||
{
|
||||
void SendNotInArenaTeamPacket(ArenaTypes type)
|
||||
{
|
||||
ArenaError arenaError = new ArenaError();
|
||||
arenaError.ErrorType = ArenaErrorType.NoTeam;
|
||||
arenaError.TeamSize = (byte)type; // team type (2=2v2, 3=3v3, 5=5v5), can be used for custom types...
|
||||
SendPacket(arenaError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,11 +57,14 @@ namespace Game
|
||||
void HandleBattlemasterJoin(BattlemasterJoin battlemasterJoin)
|
||||
{
|
||||
bool isPremade = false;
|
||||
Group grp = null;
|
||||
|
||||
BattlefieldStatusFailed battlefieldStatusFailed;
|
||||
if (battlemasterJoin.QueueIDs.Empty())
|
||||
{
|
||||
Log.outError(LogFilter.Network, $"Battleground: no bgtype received. possible cheater? {_player.GetGUID().ToString()}");
|
||||
return;
|
||||
}
|
||||
|
||||
uint bgTypeId_ = (uint)(battlemasterJoin.QueueID & 0xFFFF);
|
||||
uint bgTypeId_ = (uint)(battlemasterJoin.QueueIDs[0] & 0xFFFF);
|
||||
if (!CliDB.BattlemasterListStorage.ContainsKey(bgTypeId_))
|
||||
{
|
||||
Log.outError(LogFilter.Network, "Battleground: invalid bgtype ({0}) received. possible cheater? player guid {1}", bgTypeId_, GetPlayer().GetGUID().ToString());
|
||||
@@ -94,8 +97,12 @@ namespace Game
|
||||
return;
|
||||
|
||||
GroupJoinBattlegroundResult err = GroupJoinBattlegroundResult.None;
|
||||
|
||||
Group grp = _player.GetGroup();
|
||||
|
||||
BattlefieldStatusFailed battlefieldStatusFailed;
|
||||
// check queue conditions
|
||||
if (!battlemasterJoin.JoinAsGroup)
|
||||
if (grp == null)
|
||||
{
|
||||
if (GetPlayer().isUsingLfg())
|
||||
{
|
||||
@@ -159,11 +166,6 @@ namespace Game
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = GetPlayer().GetGroup();
|
||||
|
||||
if (!grp)
|
||||
return;
|
||||
|
||||
if (grp.GetLeaderGUID() != GetPlayer().GetGUID())
|
||||
return;
|
||||
|
||||
@@ -517,10 +519,7 @@ namespace Game
|
||||
// check real arenateam existence only here (if it was moved to group.CanJoin .. () then we would ahve to get it twice)
|
||||
ArenaTeam at = Global.ArenaTeamMgr.GetArenaTeamById(ateamId);
|
||||
if (at == null)
|
||||
{
|
||||
GetPlayer().GetSession().SendNotInArenaTeamPacket(arenatype);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the team rating for queuing
|
||||
uint arenaRating = at.GetRating();
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Game
|
||||
|
||||
packet.MarketID = templ.MarketID;
|
||||
packet.Item = templ.Item;
|
||||
packet.RandomPropertiesID = templ.Item.RandomPropertiesID;
|
||||
packet.RandomPropertiesID = 0;
|
||||
|
||||
SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -34,13 +34,14 @@ namespace Game
|
||||
{
|
||||
if (guild.IsMember(query.PlayerGuid))
|
||||
{
|
||||
guild.SendQueryResponse(this);
|
||||
guild.SendQueryResponse(this, query.PlayerGuid);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QueryGuildInfoResponse response = new QueryGuildInfoResponse();
|
||||
response.GuildGUID = query.GuildGuid;
|
||||
response.PlayerGuid = query.PlayerGuid;
|
||||
SendPacket(response);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,41 +59,44 @@ namespace Game
|
||||
|
||||
void SendAvailableHotfixes(int version)
|
||||
{
|
||||
SendPacket(new AvailableHotfixes(version, Global.DB2Mgr.GetHotfixData()));
|
||||
SendPacket(new AvailableHotfixes(version, Global.DB2Mgr.GetHotfixCount(), Global.DB2Mgr.GetHotfixData()));
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.HotfixRequest, Status = SessionStatus.Authed)]
|
||||
void HandleHotfixRequest(HotfixRequest hotfixQuery)
|
||||
{
|
||||
Dictionary<ulong, int> hotfixes = Global.DB2Mgr.GetHotfixData();
|
||||
var hotfixes = Global.DB2Mgr.GetHotfixData();
|
||||
|
||||
HotfixResponse hotfixQueryResponse = new HotfixResponse();
|
||||
foreach (ulong hotfixId in hotfixQuery.Hotfixes)
|
||||
foreach (HotfixRecord hotfixRecord in hotfixQuery.Hotfixes)
|
||||
{
|
||||
int hotfix = hotfixes.LookupByKey(hotfixId);
|
||||
if (hotfix != 0)
|
||||
var hotfixedRecords = hotfixes.LookupByKey(hotfixRecord.HotfixID);
|
||||
if (!hotfixedRecords.Empty())
|
||||
{
|
||||
var storage = Global.DB2Mgr.GetStorage(MathFunctions.Pair64_HiPart(hotfixId));
|
||||
foreach (var tableRecord in hotfixedRecords)
|
||||
{
|
||||
var storage = Global.DB2Mgr.GetStorage(hotfixRecord.TableHash);
|
||||
|
||||
HotfixResponse.HotfixData hotfixData = new HotfixResponse.HotfixData();
|
||||
hotfixData.ID = hotfixId;
|
||||
hotfixData.RecordID = hotfix;
|
||||
if (storage != null && storage.HasRecord((uint)hotfixData.RecordID))
|
||||
{
|
||||
hotfixData.Data.HasValue = true;
|
||||
storage.WriteRecord((uint)hotfixData.RecordID, GetSessionDbcLocale(), hotfixData.Data.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] blobData = Global.DB2Mgr.GetHotfixBlobData(MathFunctions.Pair64_HiPart(hotfixId), hotfix);
|
||||
if (blobData != null)
|
||||
HotfixResponse.HotfixData hotfixData = new HotfixResponse.HotfixData();
|
||||
hotfixData.Record = hotfixRecord;
|
||||
if (storage != null && storage.HasRecord((uint)hotfixData.Record.RecordID))
|
||||
{
|
||||
hotfixData.Data.HasValue = true;
|
||||
hotfixData.Data.Value.WriteBytes(blobData);
|
||||
uint pos = hotfixQueryResponse.HotfixContent.GetSize();
|
||||
storage.WriteRecord((uint)hotfixData.Record.RecordID, GetSessionDbcLocale(), hotfixQueryResponse.HotfixContent);
|
||||
hotfixData.Size.Set(hotfixQueryResponse.HotfixContent.GetSize() - pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] blobData = Global.DB2Mgr.GetHotfixBlobData(hotfixData.Record.TableHash, hotfixData.Record.RecordID);
|
||||
if (blobData != null)
|
||||
{
|
||||
hotfixData.Size.Set((uint)blobData.Length);
|
||||
hotfixQueryResponse.HotfixContent.WriteBytes(blobData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hotfixQueryResponse.Hotfixes.Add(hotfixData);
|
||||
hotfixQueryResponse.Hotfixes.Add(hotfixData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,61 +78,15 @@ namespace Game
|
||||
|
||||
inspectResult.InspecteeGUID = inspect.Target;
|
||||
inspectResult.SpecializationID = (int)player.GetUInt32Value(PlayerFields.CurrentSpecId);
|
||||
inspectResult.LifetimeMaxRank = player.GetByteValue(ActivePlayerFields.Bytes, PlayerFieldOffsets.FieldBytesOffsetLifetimeMaxPvpRank);
|
||||
inspectResult.TodayHK = player.GetUInt16Value(ActivePlayerFields.Kills, PlayerFieldOffsets.FieldKillsOffsetTodayKills);
|
||||
inspectResult.YesterdayHK = player.GetUInt16Value(ActivePlayerFields.Kills, PlayerFieldOffsets.FieldKillsOffsetYesterdayKills);
|
||||
inspectResult.LifetimeHK = player.GetUInt32Value(ActivePlayerFields.LifetimeHonorableKills);
|
||||
inspectResult.HonorLevel = player.GetUInt32Value(PlayerFields.HonorLevel);
|
||||
|
||||
SendPacket(inspectResult);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.RequestHonorStats)]
|
||||
void HandleRequestHonorStatsOpcode(RequestHonorStats request)
|
||||
{
|
||||
Player player = Global.ObjAccessor.FindPlayer(request.TargetGUID);
|
||||
if (!player)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession.HandleRequestHonorStatsOpcode: Target {0} not found.", request.TargetGUID.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetPlayer().IsWithinDistInMap(player, SharedConst.InspectDistance, false))
|
||||
return;
|
||||
|
||||
if (GetPlayer().IsValidAttackTarget(player))
|
||||
return;
|
||||
|
||||
InspectHonorStats honorStats = new InspectHonorStats();
|
||||
honorStats.PlayerGUID = request.TargetGUID;
|
||||
honorStats.LifetimeHK = player.GetUInt32Value(ActivePlayerFields.LifetimeHonorableKills);
|
||||
honorStats.YesterdayHK = player.GetUInt16Value(ActivePlayerFields.Kills, 1);
|
||||
honorStats.TodayHK = player.GetUInt16Value(ActivePlayerFields.Kills, 0);
|
||||
honorStats.LifetimeMaxRank = 0; // @todo
|
||||
|
||||
SendPacket(honorStats);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.InspectPvp)]
|
||||
void HandleInspectPVP(InspectPVPRequest request)
|
||||
{
|
||||
// @todo: deal with request.InspectRealmAddress
|
||||
|
||||
Player player = Global.ObjAccessor.FindPlayer(request.InspectTarget);
|
||||
if (!player)
|
||||
{
|
||||
Log.outDebug(LogFilter.Network, "WorldSession.HandleInspectPVP: Target {0} not found.", request.InspectTarget.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetPlayer().IsWithinDistInMap(player, SharedConst.InspectDistance, false))
|
||||
return;
|
||||
|
||||
if (GetPlayer().IsValidAttackTarget(player))
|
||||
return;
|
||||
|
||||
InspectPVPResponse response = new InspectPVPResponse();
|
||||
response.ClientGUID = request.InspectTarget;
|
||||
// @todo: fill brackets
|
||||
|
||||
SendPacket(response);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.QueryInspectAchievements)]
|
||||
void HandleQueryInspectAchievements(QueryInspectAchievements inspect)
|
||||
{
|
||||
|
||||
@@ -316,7 +316,6 @@ namespace Game
|
||||
foreach (var dungeonId in dungeons)
|
||||
lfgRoleCheckUpdate.JoinSlots.Add(Global.LFGMgr.GetLFGDungeonEntry(dungeonId));
|
||||
|
||||
lfgRoleCheckUpdate.BgQueueID = 0;
|
||||
lfgRoleCheckUpdate.GroupFinderActivityID = 0;
|
||||
if (!roleCheck.roles.Empty())
|
||||
{
|
||||
@@ -348,6 +347,8 @@ namespace Game
|
||||
lfgJoinResult.Result = (byte)joinData.result;
|
||||
if (joinData.result == LfgJoinResult.RoleCheckFailed)
|
||||
lfgJoinResult.ResultDetail = (byte)joinData.state;
|
||||
else if (joinData.result == LfgJoinResult.NoSlots)
|
||||
lfgJoinResult.BlackListNames = joinData.playersMissingRequirement;
|
||||
|
||||
foreach (var it in joinData.lockmap)
|
||||
{
|
||||
|
||||
@@ -196,42 +196,32 @@ namespace Game
|
||||
playersNear.Add(member);
|
||||
}
|
||||
|
||||
uint goldPerPlayer = (uint)(loot.gold / playersNear.Count);
|
||||
ulong goldPerPlayer = (ulong)(loot.gold / playersNear.Count);
|
||||
|
||||
foreach (var pl in playersNear)
|
||||
{
|
||||
pl.ModifyMoney(goldPerPlayer);
|
||||
pl.UpdateCriteria(CriteriaTypes.LootMoney, goldPerPlayer);
|
||||
ulong goldMod = MathFunctions.CalculatePct(goldPerPlayer, pl.GetTotalAuraModifierByMiscValue(AuraType.ModMoneyGain, 1));
|
||||
|
||||
Guild guild = Global.GuildMgr.GetGuildById(pl.GetGuildId());
|
||||
if (guild)
|
||||
{
|
||||
uint guildGold = MathFunctions.CalculatePct(goldPerPlayer, pl.GetTotalAuraModifier(AuraType.DepositBonusMoneyInGuildBankOnLoot));
|
||||
if (guildGold != 0)
|
||||
guild.HandleMemberDepositMoney(this, guildGold, true);
|
||||
}
|
||||
pl.ModifyMoney((long)(goldPerPlayer + goldMod));
|
||||
pl.UpdateCriteria(CriteriaTypes.LootMoney, goldPerPlayer);
|
||||
|
||||
LootMoneyNotify packet = new LootMoneyNotify();
|
||||
packet.Money = goldPerPlayer;
|
||||
packet.MoneyMod = goldMod;
|
||||
packet.SoleLooter = playersNear.Count <= 1 ? true : false;
|
||||
pl.SendPacket(packet);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.ModifyMoney(loot.gold);
|
||||
player.UpdateCriteria(CriteriaTypes.LootMoney, loot.gold);
|
||||
ulong goldMod = MathFunctions.CalculatePct(loot.gold, player.GetTotalAuraModifierByMiscValue(AuraType.ModMoneyGain, 1));
|
||||
|
||||
Guild guild = Global.GuildMgr.GetGuildById(player.GetGuildId());
|
||||
if (guild)
|
||||
{
|
||||
uint guildGold = MathFunctions.CalculatePct(loot.gold, player.GetTotalAuraModifier(AuraType.DepositBonusMoneyInGuildBankOnLoot));
|
||||
if (guildGold != 0)
|
||||
guild.HandleMemberDepositMoney(this, guildGold, true);
|
||||
}
|
||||
player.ModifyMoney((long)(loot.gold + goldMod));
|
||||
player.UpdateCriteria(CriteriaTypes.LootMoney, loot.gold);
|
||||
|
||||
LootMoneyNotify packet = new LootMoneyNotify();
|
||||
packet.Money = loot.gold;
|
||||
packet.MoneyMod = goldMod;
|
||||
packet.SoleLooter = true; // "You loot..."
|
||||
SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -534,6 +534,7 @@ namespace Game
|
||||
item.StackCount = (int)itemTemplate.GetBuyCount();
|
||||
item.Price = (ulong)price;
|
||||
item.DoNotFilterOnVendor = vendorItem.IgnoreFiltering;
|
||||
item.Refundable = (itemTemplate.GetFlags() & ItemFlags.ItemPurchaseRecord) != 0 && vendorItem.ExtendedCost != 0 && itemTemplate.GetMaxStackSize() == 1;
|
||||
|
||||
item.Item.ItemID = vendorItem.item;
|
||||
if (!vendorItem.BonusListIDs.Empty())
|
||||
|
||||
@@ -158,6 +158,9 @@ namespace Game
|
||||
stats.HealthScalingExpansion = creatureInfo.HealthScalingExpansion;
|
||||
stats.VignetteID = creatureInfo.VignetteID;
|
||||
stats.Class = (int)creatureInfo.UnitClass;
|
||||
stats.FadeRegionRadius = creatureInfo.FadeRegionRadius;
|
||||
stats.WidgetSetID = creatureInfo.WidgetSetID;
|
||||
stats.WidgetSetUnitConditionID = creatureInfo.WidgetSetUnitConditionID;
|
||||
|
||||
stats.Title = creatureInfo.SubName;
|
||||
stats.TitleAlt = creatureInfo.TitleAlt;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Game
|
||||
return;
|
||||
}
|
||||
|
||||
if (_collectionMgr.AddToy(item.GetEntry(), false))
|
||||
if (_collectionMgr.AddToy(item.GetEntry(), false, false))
|
||||
_player.DestroyItem(item.GetBagSlot(), item.GetSlot(), true);
|
||||
}
|
||||
|
||||
@@ -93,5 +93,11 @@ namespace Game
|
||||
spell.m_castFlagsEx |= SpellCastFlagsEx.UseToySpell;
|
||||
spell.prepare(targets);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.ToyClearFanfare)]
|
||||
void HandleToyClearFanfare(ToyClearFanfare toyClearFanfare)
|
||||
{
|
||||
_collectionMgr.ToyClearFanfare(toyClearFanfare.ItemID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user