aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIntel <chemicstry@gmail.com>2014-12-29 02:54:44 +0200
committerIntel <chemicstry@gmail.com>2014-12-29 03:05:17 +0200
commit821e2534607b36f401f12fe9f9195b01b133d911 (patch)
treeff5cde825d3c6c9a865ad9e6b6f253a362460cf3
parente8f97ec80a0ca0a1cf55aa5e2a2fd9a43ec19766 (diff)
Core/Loot: Implemented CMSG_LOOT packet
Updated Object Dynamic Flags Cleaned up obsolete code Sorted packet struct alphabetically
-rw-r--r--src/server/game/Handlers/LootHandler.cpp10
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h17
-rw-r--r--src/server/game/Quests/QuestDef.cpp73
-rw-r--r--src/server/game/Quests/QuestDef.h1
-rw-r--r--src/server/game/Server/Packets/LootPackets.cpp23
-rw-r--r--src/server/game/Server/Packets/LootPackets.h39
-rw-r--r--src/server/game/Server/Protocol/Opcodes.cpp3
-rw-r--r--src/server/game/Server/WorldSession.h45
8 files changed, 102 insertions, 109 deletions
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index 745e6f110aa..2f00c9afc89 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -30,6 +30,7 @@
#include "Player.h"
#include "World.h"
#include "WorldPacket.h"
+#include "LootPackets.h"
#include "WorldSession.h"
void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
@@ -225,18 +226,15 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
}
}
-void WorldSession::HandleLootOpcode(WorldPacket& recvData)
+void WorldSession::HandleLootOpcode(WorldPackets::Loot::LootUnit& packet)
{
TC_LOG_DEBUG("network", "WORLD: CMSG_LOOT");
- ObjectGuid guid;
- recvData >> guid;
-
// Check possible cheat
- if (!GetPlayer()->IsAlive() || !guid.IsCreatureOrVehicle())
+ if (!GetPlayer()->IsAlive() || !packet.Unit.IsCreatureOrVehicle())
return;
- GetPlayer()->SendLoot(guid, LOOT_CORPSE);
+ GetPlayer()->SendLoot(packet.Unit, LOOT_CORPSE);
// interrupt cast
if (GetPlayer()->IsNonMeleeSpellCast(false))
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index d39da48b3b6..d7660098439 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -4144,14 +4144,15 @@ enum TotemCategory
enum UnitDynFlags
{
UNIT_DYNFLAG_NONE = 0x0000,
- UNIT_DYNFLAG_LOOTABLE = 0x0001,
- UNIT_DYNFLAG_TRACK_UNIT = 0x0002,
- UNIT_DYNFLAG_TAPPED = 0x0004, // Lua_UnitIsTapped
- UNIT_DYNFLAG_TAPPED_BY_PLAYER = 0x0008, // Lua_UnitIsTappedByPlayer
- UNIT_DYNFLAG_SPECIALINFO = 0x0010,
- UNIT_DYNFLAG_DEAD = 0x0020,
- UNIT_DYNFLAG_REFER_A_FRIEND = 0x0040,
- UNIT_DYNFLAG_TAPPED_BY_ALL_THREAT_LIST = 0x0080 // Lua_UnitIsTappedByAllThreatList
+ UNIT_DYNFLAG_UNK = 0x0001,
+ UNIT_DYNFLAG_LOOTABLE = 0x0002,
+ UNIT_DYNFLAG_TRACK_UNIT = 0x0004,
+ UNIT_DYNFLAG_TAPPED = 0x0008, // Lua_UnitIsTapped
+ UNIT_DYNFLAG_TAPPED_BY_PLAYER = 0x0010, // Lua_UnitIsTappedByPlayer
+ UNIT_DYNFLAG_SPECIALINFO = 0x0020,
+ UNIT_DYNFLAG_DEAD = 0x0040,
+ UNIT_DYNFLAG_REFER_A_FRIEND = 0x0080,
+ UNIT_DYNFLAG_TAPPED_BY_ALL_THREAT_LIST = 0x0160 // Lua_UnitIsTappedByAllThreatList
};
enum CorpseDynFlags
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 691ac68e5c5..3c45f5efb38 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -245,79 +245,6 @@ int32 Quest::GetRewMoney() const
return int32(RewardMoney * sWorld->getRate(RATE_MONEY_QUEST));
}
-void Quest::BuildExtraQuestInfo(WorldPacket& data, Player* player) const
-{
- data << uint32(GetRewChoiceItemsCount());
- for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- data << uint32(RewardChoiceItemId[i]);
- for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- data << uint32(RewardChoiceItemCount[i]);
- for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- {
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardChoiceItemId[i]))
- data << uint32(/*itemTemplate->DisplayInfoID*/);
- else
- data << uint32(0);
- }
-
- data << uint32(GetRewItemsCount());
- for (uint8 i = 0; i < QUEST_REWARD_ITEM_COUNT; ++i)
- data << uint32(RewardItemId[i]);
- for (uint8 i = 0; i < QUEST_REWARD_ITEM_COUNT; ++i)
- data << uint32(RewardItemCount[i]);
- for (uint8 i = 0; i < QUEST_REWARD_ITEM_COUNT; ++i)
- {
- if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(RewardItemId[i]))
- data << uint32(/*itemTemplate->DisplayInfoID*/);
- else
- data << uint32(0);
- }
-
- data << uint32(GetRewMoney());
- data << uint32(player->GetQuestXPReward(this));
-
- data << uint32(GetRewTitle());
- data << uint32(0); // unk
- data << float(0.0f); // unk
- data << uint32(GetBonusTalents());
- data << uint32(0); // unk
- data << uint32(GetRewardReputationMask());
-
- /* Pre cata struct, some of these unks might be the missing values in cata:
- // rewarded honor points. Multiply with 10 to satisfy client
- data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier());
- data << float(0); // unk, honor multiplier?
- data << uint32(0x08); // unused by client?
- data << uint32(quest->GetRewDisplaySpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
- data << int32(quest->GetRewSpell()); // casted spell
- data << uint32(0); // unknown
- data << uint32(quest->GetBonusTalents()); // bonus talents
- data << uint32(quest->GetRewArenaPoints()); // arena points
- data << uint32(0);
- */
-
- for (uint8 i = 0; i < QUEST_REWARD_REPUTATIONS_COUNT; ++i) // reward factions ids
- data << uint32(RewardFactionId[i]);
-
- for (uint8 i = 0; i < QUEST_REWARD_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)?
- data << int32(RewardFactionValue[i]);
-
- for (uint8 i = 0; i < QUEST_REWARD_REPUTATIONS_COUNT; ++i) // reward reputation override?
- data << uint32(RewardFactionOverride[i]);
-
- data << uint32(GetRewDisplaySpell());
- data << uint32(GetRewSpell());
-
- for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
- data << uint32(RewardCurrencyId[i]);
-
- for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
- data << uint32(RewardCurrencyCount[i]);
-
- data << uint32(GetRewardSkillId());
- data << uint32(GetRewardSkillPoints());
-}
-
void Quest::BuildQuestRewards(WorldPackets::Quest::QuestRewards& rewards, Player* player) const
{
rewards.ChoiceItemCount = GetRewChoiceItemsCount();
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 75981d30368..d5e81bc261b 100644
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -345,7 +345,6 @@ class Quest
uint32 GetRewItemsCount() const { return _rewItemsCount; }
uint32 GetRewCurrencyCount() const { return _rewCurrencyCount; }
- void BuildExtraQuestInfo(WorldPacket& data, Player* player) const;
void BuildQuestRewards(WorldPackets::Quest::QuestRewards& rewards, Player* player) const;
typedef std::vector<int32> PrevQuests;
diff --git a/src/server/game/Server/Packets/LootPackets.cpp b/src/server/game/Server/Packets/LootPackets.cpp
new file mode 100644
index 00000000000..45c45964210
--- /dev/null
+++ b/src/server/game/Server/Packets/LootPackets.cpp
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2008-2014 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 "LootPackets.h"
+
+void WorldPackets::Loot::LootUnit::Read()
+{
+ _worldPacket >> Unit;
+}
diff --git a/src/server/game/Server/Packets/LootPackets.h b/src/server/game/Server/Packets/LootPackets.h
new file mode 100644
index 00000000000..d555040f3d9
--- /dev/null
+++ b/src/server/game/Server/Packets/LootPackets.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2008-2014 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 LootPackets_h__
+#define LootPackets_h__
+
+#include "Packet.h"
+
+namespace WorldPackets
+{
+ namespace Loot
+ {
+ class LootUnit final : public ClientPacket
+ {
+ public:
+ LootUnit(WorldPacket&& packet) : ClientPacket(CMSG_LOOT, std::move(packet)) { }
+
+ void Read() override;
+
+ ObjectGuid Unit;
+ };
+ }
+}
+
+#endif // LootPackets_h__
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 1612b01ccd2..6919d457ecb 100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -28,6 +28,7 @@
#include "Packets/GameObjectPackets.h"
#include "Packets/GuildPackets.h"
#include "Packets/ItemPackets.h"
+#include "Packets/LootPackets.h"
#include "Packets/MiscPackets.h"
#include "Packets/MovementPackets.h"
#include "Packets/NPCPackets.h"
@@ -410,7 +411,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_LOGOUT_CANCEL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Character::LogoutCancel, &WorldSession::HandleLogoutCancelOpcode);
DEFINE_HANDLER(CMSG_LOGOUT_REQUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Character::LogoutRequest, &WorldSession::HandleLogoutRequestOpcode);
DEFINE_OPCODE_HANDLER_OLD(CMSG_LOG_DISCONNECT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess );
- DEFINE_OPCODE_HANDLER_OLD(CMSG_LOOT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleLootOpcode );
+ DEFINE_HANDLER(CMSG_LOOT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Loot::LootUnit, &WorldSession::HandleLootOpcode);
DEFINE_OPCODE_HANDLER_OLD(CMSG_LOOT_CURRENCY, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER_OLD(CMSG_LOOT_MASTER_GIVE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleLootMasterGiveOpcode );
DEFINE_OPCODE_HANDLER_OLD(CMSG_LOOT_METHOD, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleLootMethodOpcode );
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 68b89af6ce6..55b4a13e99f 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -133,26 +133,29 @@ namespace WorldPackets
class SaveEquipmentSet;
}
- namespace Guild
+ namespace GameObject
{
- class QueryGuildInfo;
+ class GameObjectReportUse;
+ class GameObjectUse;
}
- namespace Spells
+ namespace Guild
{
- class SpellCastRequest;
- class SetActionButton;
+ class QueryGuildInfo;
}
- namespace Talent
+ namespace Item
{
- class SetSpecialization;
- class LearnTalent;
+ class SplitItem;
+ class SwapInvItem;
+ class SwapItem;
+ class AutoEquipItem;
+ class DestroyItem;
}
- namespace Trade
+ namespace Loot
{
- class CancelTrade;
+ class LootUnit;
}
namespace Misc
@@ -195,19 +198,21 @@ namespace WorldPackets
class QuestGiverCompleteQuest;
}
- namespace Item
+ namespace Spells
{
- class SplitItem;
- class SwapInvItem;
- class SwapItem;
- class AutoEquipItem;
- class DestroyItem;
+ class SpellCastRequest;
+ class SetActionButton;
}
- namespace GameObject
+ namespace Talent
{
- class GameObjectReportUse;
- class GameObjectUse;
+ class SetSpecialization;
+ class LearnTalent;
+ }
+
+ namespace Trade
+ {
+ class CancelTrade;
}
}
@@ -661,7 +666,7 @@ class WorldSession
void HandleRepopRequestOpcode(WorldPacket& recvPacket);
void HandleAutostoreLootItemOpcode(WorldPacket& recvPacket);
void HandleLootMoneyOpcode(WorldPacket& recvPacket);
- void HandleLootOpcode(WorldPacket& recvPacket);
+ void HandleLootOpcode(WorldPackets::Loot::LootUnit& packet);
void HandleLootReleaseOpcode(WorldPacket& recvPacket);
void HandleLootMasterGiveOpcode(WorldPacket& recvPacket);
void HandleWhoOpcode(WorldPacket& recvPacket);