aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-02-20 18:08:40 -0300
committerariel- <ariel-@users.noreply.github.com>2017-02-21 03:03:58 -0300
commitdd1aa64563bfb726e1132a135927a02fbb765454 (patch)
tree7b60326913feab118019a8c9e5bc3d8999882f7e /src/server/game/Server
parentc274ea8a98e9751d50301e99eb55577ba19155f2 (diff)
Core/Packet: convert query packets into new system.
- Extra c++11-ification of existing code - Refs #18637
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/Packets/AllPackets.h3
-rw-r--r--src/server/game/Server/Packets/QueryPackets.cpp209
-rw-r--r--src/server/game/Server/Packets/QueryPackets.h240
-rw-r--r--src/server/game/Server/Packets/QuestPackets.cpp128
-rw-r--r--src/server/game/Server/Packets/QuestPackets.h114
-rw-r--r--src/server/game/Server/WorldSession.h22
6 files changed, 711 insertions, 5 deletions
diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h
index ef92b2584ba..ed9f6807ec0 100644
--- a/src/server/game/Server/Packets/AllPackets.h
+++ b/src/server/game/Server/Packets/AllPackets.h
@@ -18,4 +18,7 @@
#ifndef AllPackets_h__
#define AllPackets_h__
+#include "QueryPackets.h"
+#include "QuestPackets.h"
+
#endif // AllPackets_h__
diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp
new file mode 100644
index 00000000000..73c27c659da
--- /dev/null
+++ b/src/server/game/Server/Packets/QueryPackets.cpp
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#include "QueryPackets.h"
+
+void WorldPackets::Query::QueryCreature::Read()
+{
+ _worldPacket >> CreatureID;
+ _worldPacket >> Guid;
+}
+
+WorldPacket const* WorldPackets::Query::QueryCreatureResponse::Write()
+{
+ _worldPacket << uint32(CreatureID | (Allow ? 0x00000000 : 0x80000000)); // creature entry
+
+ if (Allow)
+ {
+ _worldPacket << Stats.Name;
+ _worldPacket << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty
+ _worldPacket << Stats.NameAlt;
+ _worldPacket << Stats.CursorName; // "Directions" for guard, string for Icons 2.3.0
+ _worldPacket << uint32(Stats.Flags); // flags
+ _worldPacket << uint32(Stats.CreatureType); // CreatureType.dbc
+ _worldPacket << uint32(Stats.CreatureFamily); // CreatureFamily.dbc
+ _worldPacket << uint32(Stats.Classification); // Creature Rank (elite, boss, etc)
+ _worldPacket.append(Stats.ProxyCreatureID, MAX_KILL_CREDIT); // new in 3.1, kill credit
+ _worldPacket.append(Stats.CreatureDisplayID, MAX_CREATURE_MODELS); // Modelid
+ _worldPacket << float(Stats.HpMulti); // dmg/hp modifier
+ _worldPacket << float(Stats.EnergyMulti); // dmg/mana modifier
+ _worldPacket << uint8(Stats.Leader);
+ _worldPacket.append(Stats.QuestItems, MAX_CREATURE_QUEST_ITEMS);
+ _worldPacket << uint32(Stats.CreatureMovementInfoID); // CreatureMovementInfo.dbc
+ }
+
+ return &_worldPacket;
+}
+
+void WorldPackets::Query::QueryGameObject::Read()
+{
+ _worldPacket >> GameObjectID;
+ _worldPacket >> Guid;
+}
+
+WorldPacket const* WorldPackets::Query::QueryGameObjectResponse::Write()
+{
+ _worldPacket << uint32(GameObjectID | (Allow ? 0x00000000 : 0x80000000));
+
+ if (Allow)
+ {
+ _worldPacket << uint32(Stats.Type);
+ _worldPacket << uint32(Stats.DisplayID);
+ _worldPacket << Stats.Name;
+ _worldPacket << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4
+ _worldPacket << Stats.IconName; // 2.0.3, string. Icon name to use instead of default icon for go's (ex: "Attack" makes sword)
+ _worldPacket << Stats.CastBarCaption; // 2.0.3, string. Text will appear in Cast Bar when using GO (ex: "Collecting")
+ _worldPacket << Stats.UnkString; // 2.0.3, string
+ _worldPacket.append(Stats.Data, MAX_GAMEOBJECT_DATA);
+ _worldPacket << float(Stats.Size); // go size
+ _worldPacket.append(Stats.QuestItems, MAX_GAMEOBJECT_QUEST_ITEMS);
+ }
+
+ return &_worldPacket;
+}
+
+void WorldPackets::Query::QueryItemSingle::Read()
+{
+ _worldPacket >> ItemID;
+}
+
+WorldPacket const* WorldPackets::Query::QueryItemSingleResponse::Write()
+{
+ _worldPacket << uint32(ItemID | (Allow ? 0x00000000 : 0x80000000));
+
+ if (Allow)
+ {
+ _worldPacket << Stats.Class;
+ _worldPacket << Stats.SubClass;
+ _worldPacket << Stats.SoundOverrideSubclass;
+ _worldPacket << Stats.Name;
+ _worldPacket << uint8(0x00); //Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
+ _worldPacket << uint8(0x00); //Name3; // blizz not send name there, just uint8(0x00);
+ _worldPacket << uint8(0x00); //Name4; // blizz not send name there, just uint8(0x00);
+ _worldPacket << Stats.DisplayInfoID;
+ _worldPacket << Stats.Quality;
+ _worldPacket << Stats.Flags;
+ _worldPacket << Stats.Flags2;
+ _worldPacket << Stats.BuyPrice;
+ _worldPacket << Stats.SellPrice;
+ _worldPacket << Stats.InventoryType;
+ _worldPacket << Stats.AllowableClass;
+ _worldPacket << Stats.AllowableRace;
+ _worldPacket << Stats.ItemLevel;
+ _worldPacket << Stats.RequiredLevel;
+ _worldPacket << Stats.RequiredSkill;
+ _worldPacket << Stats.RequiredSkillRank;
+ _worldPacket << Stats.RequiredSpell;
+ _worldPacket << Stats.RequiredHonorRank;
+ _worldPacket << Stats.RequiredCityRank;
+ _worldPacket << Stats.RequiredReputationFaction;
+ _worldPacket << Stats.RequiredReputationRank;
+ _worldPacket << int32(Stats.MaxCount);
+ _worldPacket << int32(Stats.Stackable);
+ _worldPacket << Stats.ContainerSlots;
+ _worldPacket << Stats.StatsCount; // item stats count
+ for (uint32 i = 0; i < Stats.StatsCount; ++i)
+ {
+ _worldPacket << Stats.ItemStat[i].ItemStatType;
+ _worldPacket << Stats.ItemStat[i].ItemStatValue;
+ }
+ _worldPacket << Stats.ScalingStatDistribution; // scaling stats distribution
+ _worldPacket << Stats.ScalingStatValue; // some kind of flags used to determine stat values column
+ for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
+ {
+ _worldPacket << Stats.Damage[i].DamageMin;
+ _worldPacket << Stats.Damage[i].DamageMax;
+ _worldPacket << Stats.Damage[i].DamageType;
+ }
+
+ // resistances (7)
+ for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
+ _worldPacket << Stats.Resistance[i];
+
+ _worldPacket << Stats.Delay;
+ _worldPacket << Stats.AmmoType;
+ _worldPacket << Stats.RangedModRange;
+
+ for (uint8 s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
+ {
+ // spells are validated on template loading
+ if (Stats.Spells[s].SpellId > 0)
+ {
+ _worldPacket << Stats.Spells[s].SpellId;
+ _worldPacket << Stats.Spells[s].SpellTrigger;
+ _worldPacket << uint32(-abs(Stats.Spells[s].SpellCharges));
+ _worldPacket << uint32(Stats.Spells[s].SpellCooldown);
+ _worldPacket << uint32(Stats.Spells[s].SpellCategory);
+ _worldPacket << uint32(Stats.Spells[s].SpellCategoryCooldown);
+ }
+ else
+ {
+ _worldPacket << uint32(0);
+ _worldPacket << uint32(0);
+ _worldPacket << uint32(0);
+ _worldPacket << uint32(-1);
+ _worldPacket << uint32(0);
+ _worldPacket << uint32(-1);
+ }
+ }
+ _worldPacket << Stats.Bonding;
+ _worldPacket << Stats.Description;
+ _worldPacket << Stats.PageText;
+ _worldPacket << Stats.LanguageID;
+ _worldPacket << Stats.PageMaterial;
+ _worldPacket << Stats.StartQuest;
+ _worldPacket << Stats.LockID;
+ _worldPacket << int32(Stats.Material);
+ _worldPacket << Stats.Sheath;
+ _worldPacket << Stats.RandomProperty;
+ _worldPacket << Stats.RandomSuffix;
+ _worldPacket << Stats.Block;
+ _worldPacket << Stats.ItemSet;
+ _worldPacket << Stats.MaxDurability;
+ _worldPacket << Stats.Area;
+ _worldPacket << Stats.Map; // Added in 1.12.x & 2.0.1 client branch
+ _worldPacket << Stats.BagFamily;
+ _worldPacket << Stats.TotemCategory;
+ for (uint8 s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s)
+ {
+ _worldPacket << Stats.Socket[s].Color;
+ _worldPacket << Stats.Socket[s].Content;
+ }
+ _worldPacket << Stats.SocketBonus;
+ _worldPacket << Stats.GemProperties;
+ _worldPacket << Stats.RequiredDisenchantSkill;
+ _worldPacket << Stats.ArmorDamageModifier;
+ _worldPacket << Stats.Duration; // added in 2.4.2.8209, duration (seconds)
+ _worldPacket << Stats.ItemLimitCategory; // WotLK, ItemLimitCategory
+ _worldPacket << Stats.HolidayId; // Holiday.dbc?
+ }
+
+ return &_worldPacket;
+}
+
+void WorldPackets::Query::QuestPOIQuery::Read()
+{
+ _worldPacket >> MissingQuestCount; // quest count, max=25
+
+ if (MissingQuestCount <= MAX_QUEST_LOG_SIZE)
+ {
+ for (uint8 i = 0; i < MissingQuestCount; ++i)
+ _worldPacket >> MissingQuestPOIs[i];
+ }
+
+ _worldPacket.rfinish();
+}
diff --git a/src/server/game/Server/Packets/QueryPackets.h b/src/server/game/Server/Packets/QueryPackets.h
new file mode 100644
index 00000000000..d7ec602f089
--- /dev/null
+++ b/src/server/game/Server/Packets/QueryPackets.h
@@ -0,0 +1,240 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#ifndef QueryPackets_h__
+#define QueryPackets_h__
+
+#include "Packet.h"
+#include "ObjectGuid.h"
+
+#include "SharedDefines.h"
+#include "Creature.h"
+#include "GameObject.h"
+#include "ItemTemplate.h"
+#include "QuestDef.h"
+
+namespace WorldPackets
+{
+ namespace Query
+ {
+ class QueryCreature final : public ClientPacket
+ {
+ public:
+ QueryCreature(WorldPacket&& packet) : ClientPacket(CMSG_CREATURE_QUERY, std::move(packet)) { }
+
+ void Read() override;
+
+ uint32 CreatureID = 0;
+ ObjectGuid Guid;
+ };
+
+ struct CreatureStats
+ {
+ std::string Name;
+ std::string NameAlt;
+ std::string CursorName;
+ uint32 Flags = 0;
+ uint32 CreatureType = 0;
+ uint32 CreatureFamily = 0;
+ uint32 Classification = 0;
+ uint32 ProxyCreatureID[MAX_KILL_CREDIT];
+ uint32 CreatureDisplayID[MAX_CREATURE_MODELS];
+ float HpMulti = 0.0f;
+ float EnergyMulti = 0.0f;
+ bool Leader = false;
+ uint32 QuestItems[MAX_CREATURE_QUEST_ITEMS];
+ uint32 CreatureMovementInfoID = 0;
+ };
+
+ class QueryCreatureResponse final : public ServerPacket
+ {
+ public:
+ QueryCreatureResponse() : ServerPacket(SMSG_CREATURE_QUERY_RESPONSE, 100) { }
+
+ WorldPacket const* Write() override;
+
+ bool Allow = false;
+ CreatureStats Stats;
+ uint32 CreatureID = 0;
+ };
+
+ class QueryGameObject final : public ClientPacket
+ {
+ public:
+ QueryGameObject(WorldPacket&& packet) : ClientPacket(CMSG_GAMEOBJECT_QUERY, std::move(packet)) { }
+
+ void Read() override;
+
+ uint32 GameObjectID = 0;
+ ObjectGuid Guid;
+ };
+
+ struct GameObjectStats
+ {
+ std::string Name;
+ std::string IconName;
+ std::string CastBarCaption;
+ std::string UnkString;
+ uint32 Type = 0;
+ uint32 DisplayID = 0;
+ uint32 Data[MAX_GAMEOBJECT_DATA];
+ float Size = 0.0f;
+ uint32 QuestItems[MAX_GAMEOBJECT_QUEST_ITEMS];
+ };
+
+ class QueryGameObjectResponse final : public ServerPacket
+ {
+ public:
+ QueryGameObjectResponse() : ServerPacket(SMSG_GAMEOBJECT_QUERY_RESPONSE, 150) { }
+
+ WorldPacket const* Write() override;
+
+ uint32 GameObjectID = 0;
+ bool Allow = false;
+ GameObjectStats Stats;
+ };
+
+ class QueryItemSingle final : public ClientPacket
+ {
+ public:
+ QueryItemSingle(WorldPacket&& packet) : ClientPacket(CMSG_ITEM_QUERY_SINGLE, std::move(packet)) { }
+
+ void Read() override;
+
+ uint32 ItemID = 0;
+ };
+
+ struct ItemDamageData
+ {
+ float DamageMin = 0.0f;
+ float DamageMax = 0.0f;
+ uint32 DamageType = 0;
+ };
+
+ struct ItemStatData
+ {
+ uint32 ItemStatType = 0;
+ int32 ItemStatValue = 0;
+ };
+
+ struct ItemSpellData
+ {
+ int32 SpellId = -1;
+ uint32 SpellTrigger = 0;
+ int32 SpellCharges = 0;
+ int32 SpellCooldown = -1;
+ uint32 SpellCategory = 0;
+ int32 SpellCategoryCooldown = -1;
+ };
+
+ struct ItemSocketData
+ {
+ uint32 Color = 0;
+ uint32 Content = 0;
+ };
+
+ struct ItemStats
+ {
+ uint32 Class = 0;
+ uint32 SubClass = 0;
+ int32 SoundOverrideSubclass = 0;
+ std::string Name;
+ uint32 DisplayInfoID = 0;
+ uint32 Quality = 0;
+ uint32 Flags = 0;
+ uint32 Flags2 = 0;
+ int32 BuyPrice = 0;
+ uint32 SellPrice = 0;
+ uint32 InventoryType = 0;
+ uint32 AllowableClass = 0;
+ uint32 AllowableRace = 0;
+ uint32 ItemLevel = 0;
+ uint32 RequiredLevel = 0;
+ uint32 RequiredSkill = 0;
+ uint32 RequiredSkillRank = 0;
+ uint32 RequiredSpell = 0;
+ uint32 RequiredHonorRank = 0;
+ uint32 RequiredCityRank = 0;
+ uint32 RequiredReputationFaction = 0;
+ uint32 RequiredReputationRank = 0;
+ int32 MaxCount = 0;
+ int32 Stackable = 0;
+ uint32 ContainerSlots = 0;
+ uint32 StatsCount = 0;
+ ItemStatData ItemStat[MAX_ITEM_PROTO_STATS];
+ uint32 ScalingStatDistribution = 0;
+ uint32 ScalingStatValue = 0;
+ ItemDamageData Damage[MAX_ITEM_PROTO_DAMAGES];
+ uint32 Resistance[MAX_SPELL_SCHOOL];
+ uint32 Delay = 0;
+ uint32 AmmoType = 0;
+ float RangedModRange = 0.0f;
+ ItemSpellData Spells[MAX_ITEM_PROTO_SPELLS];
+ uint32 Bonding = 0;
+ std::string Description;
+ uint32 PageText = 0;
+ uint32 LanguageID = 0;
+ uint32 PageMaterial = 0;
+ uint32 StartQuest = 0;
+ uint32 LockID = 0;
+ int32 Material = 0;
+ uint32 Sheath = 0;
+ int32 RandomProperty = 0;
+ int32 RandomSuffix = 0;
+ uint32 Block = 0;
+ uint32 ItemSet = 0;
+ uint32 MaxDurability = 0;
+ uint32 Area = 0;
+ uint32 Map = 0;
+ uint32 BagFamily = 0;
+ uint32 TotemCategory = 0;
+ ItemSocketData Socket[MAX_ITEM_PROTO_SOCKETS];
+ uint32 SocketBonus = 0;
+ uint32 GemProperties = 0;
+ uint32 RequiredDisenchantSkill = 0;
+ float ArmorDamageModifier = 0.0f;
+ uint32 Duration = 0;
+ uint32 ItemLimitCategory = 0;
+ uint32 HolidayId = 0;
+ };
+
+ class QueryItemSingleResponse final : public ServerPacket
+ {
+ public:
+ QueryItemSingleResponse() : ServerPacket(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 500) { }
+
+ WorldPacket const* Write() override;
+
+ uint32 ItemID = 0;
+ bool Allow = false;
+ ItemStats Stats;
+ };
+
+ class QuestPOIQuery final : public ClientPacket
+ {
+ public:
+ QuestPOIQuery(WorldPacket&& packet) : ClientPacket(CMSG_QUEST_POI_QUERY, std::move(packet)) { }
+
+ void Read() override;
+
+ uint32 MissingQuestCount = 0;
+ uint32 MissingQuestPOIs[MAX_QUEST_LOG_SIZE] = { };
+ };
+ }
+}
+
+#endif // QueryPackets_h__
diff --git a/src/server/game/Server/Packets/QuestPackets.cpp b/src/server/game/Server/Packets/QuestPackets.cpp
new file mode 100644
index 00000000000..68e28ca80ab
--- /dev/null
+++ b/src/server/game/Server/Packets/QuestPackets.cpp
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#include "QuestPackets.h"
+
+void WorldPackets::Quest::QueryQuestInfo::Read()
+{
+ _worldPacket >> QuestID;
+}
+
+WorldPacket const* WorldPackets::Quest::QueryQuestInfoResponse::Write()
+{
+ _worldPacket << uint32(Info.QuestID);
+ _worldPacket << uint32(Info.QuestMethod);
+ _worldPacket << uint32(Info.QuestLevel);
+ _worldPacket << uint32(Info.QuestMinLevel);
+ _worldPacket << uint32(Info.QuestSortID);
+
+ _worldPacket << uint32(Info.QuestType);
+ _worldPacket << uint32(Info.SuggestedGroupNum);
+
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
+ {
+ _worldPacket << uint32(Info.RequiredFactionId[i]);
+ _worldPacket << uint32(Info.RequiredFactionValue[i]);
+ }
+
+ _worldPacket << uint32(Info.RewardNextQuest);
+ _worldPacket << uint32(Info.RewardXPDifficulty);
+
+ if ((Info.Flags & QUEST_FLAGS_HIDDEN_REWARDS) != 0)
+ _worldPacket << uint32(0);
+ else
+ _worldPacket << uint32(Info.RewardMoney);
+
+ _worldPacket << uint32(Info.RewardBonusMoney);
+ _worldPacket << uint32(Info.RewardDisplaySpell);
+ _worldPacket << int32(Info.RewardSpell);
+
+ _worldPacket << uint32(Info.RewardHonor);
+ _worldPacket << float(Info.RewardKillHonor);
+ _worldPacket << uint32(Info.StartItem);
+ _worldPacket << uint32(Info.Flags & 0xFFFF);
+ _worldPacket << uint32(Info.RewardTitleId);
+ _worldPacket << uint32(Info.RequiredPlayerKills);
+ _worldPacket << uint32(Info.RewardTalents);
+ _worldPacket << uint32(Info.RewardArenaPoints);
+ _worldPacket << uint32(0); // review rep show mask
+
+ if ((Info.Flags & QUEST_FLAGS_HIDDEN_REWARDS) != 0)
+ {
+ for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ _worldPacket << uint32(0) << uint32(0);
+ for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ _worldPacket << uint32(0) << uint32(0);
+ }
+ else
+ {
+ for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
+ {
+ _worldPacket << uint32(Info.RewardItems[i]);
+ _worldPacket << uint32(Info.RewardAmount[i]);
+ }
+ for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
+ {
+ _worldPacket << uint32(Info.UnfilteredChoiceItems[i].ItemID);
+ _worldPacket << uint32(Info.UnfilteredChoiceItems[i].Quantity);
+ }
+ }
+
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
+ _worldPacket << uint32(Info.RewardFactionID[i]);
+
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc?
+ _worldPacket << int32(Info.RewardFactionValue[i]);
+
+ for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0)
+ _worldPacket << int32(Info.RewardFactionValueOverride[i]);
+
+ _worldPacket << uint32(Info.POIContinent);
+ _worldPacket << float(Info.POIx);
+ _worldPacket << float(Info.POIy);
+ _worldPacket << uint32(Info.POIPriority);
+
+ _worldPacket << Info.Title;
+ _worldPacket << Info.Objectives;
+ _worldPacket << Info.Details;
+ _worldPacket << Info.AreaDescription;
+ _worldPacket << Info.CompletedText;
+
+ for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ {
+ if (Info.RequiredNpcOrGo[i] < 0)
+ _worldPacket << uint32((Info.RequiredNpcOrGo[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000)
+ else
+ _worldPacket << uint32(Info.RequiredNpcOrGo[i]);
+
+ _worldPacket << uint32(Info.RequiredNpcOrGoCount[i]);
+
+ _worldPacket << uint32(Info.ItemDrop[i]);
+ _worldPacket << uint32(0); // req source count?
+ }
+
+ for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
+ {
+ _worldPacket << uint32(Info.RequiredItemId[i]);
+ _worldPacket << uint32(Info.RequiredItemCount[i]);
+ }
+
+ for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ _worldPacket << Info.ObjectiveText[i];
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/QuestPackets.h b/src/server/game/Server/Packets/QuestPackets.h
new file mode 100644
index 00000000000..4d6e2121736
--- /dev/null
+++ b/src/server/game/Server/Packets/QuestPackets.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 2 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/>.
+ */
+
+#ifndef QuestPackets_h__
+#define QuestPackets_h__
+
+#include "Packet.h"
+#include "QuestDef.h"
+
+namespace WorldPackets
+{
+ namespace Quest
+ {
+ class QueryQuestInfo final : public ClientPacket
+ {
+ public:
+ QueryQuestInfo(WorldPacket&& packet) : ClientPacket(CMSG_QUEST_QUERY, std::move(packet)) { }
+
+ void Read() override;
+
+ uint32 QuestID = 0;
+ };
+
+ struct QuestInfoChoiceItem
+ {
+ uint32 ItemID = 0;
+ uint32 Quantity = 0;
+ };
+
+ struct QuestInfo
+ {
+ uint32 QuestID = 0;
+ uint32 QuestMethod = 0; // Accepted values: 0, 1 or 2. 0 == IsAutoComplete() (skip objectives/details)
+ int32 QuestLevel = 0; // may be -1, static data, in other cases must be used dynamic level: Player::GetQuestLevel (0 is not known, but assuming this is no longer valid for quest intended for client)
+ uint32 QuestMinLevel = 0;
+ int32 QuestSortID = 0; // zone or sort to display in quest log
+ uint32 QuestType = 0;
+ uint32 SuggestedGroupNum = 0;
+ int32 AllowableRaces = -1;
+
+ uint32 RequiredFactionId[BG_TEAMS_COUNT] = { }; // shown in quest log as part of quest objective (same/opposite faction)
+ int32 RequiredFactionValue[BG_TEAMS_COUNT] = { }; // shown in quest log as part of quest objective (same/opposite faction)
+
+ uint32 RewardNextQuest = 0; // client will request this quest from NPC, if not 0
+ uint32 RewardXPDifficulty = 0; // used for calculating rewarded experience
+ int32 RewardMoney = 0; // reward money (below max lvl)
+ uint32 RewardBonusMoney = 0; // used in XP calculation at client
+ uint32 RewardDisplaySpell = 0; // reward spell, this spell will be displayed (icon) (cast if RewSpellCast == 0)
+ int32 RewardSpell = 0;
+ uint32 RewardHonor = 0;
+ float RewardKillHonor = 0.0f;
+ uint32 StartItem = 0;
+ uint32 Flags = 0;
+ uint32 RewardTitleId = 0; // new 2.4.0, player gets this title (id from CharTitles)
+ uint32 RequiredPlayerKills = 0;
+ uint32 RewardTalents = 0;
+ int32 RewardArenaPoints = 0;
+
+ uint32 RewardItems[QUEST_REWARDS_COUNT] = { };
+ uint32 RewardAmount[QUEST_REWARDS_COUNT] = { };
+ QuestInfoChoiceItem UnfilteredChoiceItems[QUEST_REWARD_CHOICES_COUNT];
+ uint32 RewardFactionID[QUEST_REPUTATIONS_COUNT] = { };
+ int32 RewardFactionValue[QUEST_REPUTATIONS_COUNT] = { };
+ int32 RewardFactionValueOverride[QUEST_REPUTATIONS_COUNT] = { };
+
+ uint32 POIContinent = 0;
+ float POIx = 0.0f;
+ float POIy = 0.0f;
+ uint32 POIPriority = 0;
+ std::string Title;
+ std::string Objectives;
+ std::string Details;
+ std::string AreaDescription;
+ std::string CompletedText; // display in quest objectives window once all objectives are completed
+
+ int32 RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT] = { }; // >0 Creature <0 Gameobject
+ uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT] = { };
+
+ uint32 ItemDrop[QUEST_SOURCE_ITEM_IDS_COUNT] = { };
+ // uint32 ItemDropQuantity[QUEST_SOURCE_ITEM_IDS_COUNT] = { };
+
+ uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT] = { };
+ uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT] = { };
+
+ std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
+ };
+
+ class QueryQuestInfoResponse final : public ServerPacket
+ {
+ public:
+ QueryQuestInfoResponse() : ServerPacket(SMSG_QUEST_QUERY_RESPONSE, 2000) { }
+
+ WorldPacket const* Write() override;
+
+ QuestInfo Info;
+ };
+ }
+}
+
+#endif // QuestPackets_h__
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 1e66e832a04..e5ae690246f 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -71,7 +71,19 @@ class RBACData;
namespace WorldPackets
{
+ namespace Query
+ {
+ class QueryCreature;
+ class QueryGameObject;
+ class QueryItemSingle;
+ class QuestPOIQuery;
+ }
+ namespace Quest
+ {
+ class QueryQuestInfo;
+ }
}
+
enum AccountDataType
{
GLOBAL_CONFIG_CACHE = 0, // 0x01 g
@@ -570,9 +582,9 @@ class TC_GAME_API WorldSession
void HandleQueryTimeOpcode(WorldPacket& recvPacket);
- void HandleCreatureQueryOpcode(WorldPacket& recvPacket);
+ void HandleCreatureQueryOpcode(WorldPackets::Query::QueryCreature& query);
- void HandleGameObjectQueryOpcode(WorldPacket& recvPacket);
+ void HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObject& query);
void HandleMoveWorldportAckOpcode(WorldPacket& recvPacket);
void HandleMoveWorldportAck(); // for server-side calls
@@ -710,7 +722,7 @@ class TC_GAME_API WorldSession
void HandleSwapInvItemOpcode(WorldPacket& recvPacket);
void HandleDestroyItemOpcode(WorldPacket& recvPacket);
void HandleAutoEquipItemOpcode(WorldPacket& recvPacket);
- void HandleItemQuerySingleOpcode(WorldPacket& recvPacket);
+ void HandleItemQuerySingleOpcode(WorldPackets::Query::QueryItemSingle& query);
void HandleSellItemOpcode(WorldPacket& recvPacket);
void HandleBuyItemInSlotOpcode(WorldPacket& recvPacket);
void HandleBuyItemOpcode(WorldPacket& recvPacket);
@@ -749,7 +761,7 @@ class TC_GAME_API WorldSession
void HandleQuestgiverQueryQuestOpcode(WorldPacket& recvPacket);
void HandleQuestgiverChooseRewardOpcode(WorldPacket& recvPacket);
void HandleQuestgiverRequestRewardOpcode(WorldPacket& recvPacket);
- void HandleQuestQueryOpcode(WorldPacket& recvPacket);
+ void HandleQuestQueryOpcode(WorldPackets::Quest::QueryQuestInfo& query);
void HandleQuestgiverCancel(WorldPacket& recvData);
void HandleQuestLogSwapQuest(WorldPacket& recvData);
void HandleQuestLogRemoveQuest(WorldPacket& recvData);
@@ -970,7 +982,7 @@ class TC_GAME_API WorldSession
void HandleWorldStateUITimerUpdate(WorldPacket& recvData);
void HandleReadyForAccountDataTimes(WorldPacket& recvData);
void HandleQueryQuestsCompleted(WorldPacket& recvData);
- void HandleQuestPOIQuery(WorldPacket& recvData);
+ void HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& query);
void HandleEjectPassenger(WorldPacket& data);
void HandleEnterPlayerVehicle(WorldPacket& data);
void HandleUpdateProjectilePosition(WorldPacket& recvPacket);