mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Loot: Implemented CMSG_LOOT packet
Updated Object Dynamic Flags Cleaned up obsolete code Sorted packet struct alphabetically
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
23
src/server/game/Server/Packets/LootPackets.cpp
Normal file
23
src/server/game/Server/Packets/LootPackets.cpp
Normal file
@@ -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;
|
||||
}
|
||||
39
src/server/game/Server/Packets/LootPackets.h
Normal file
39
src/server/game/Server/Packets/LootPackets.h
Normal file
@@ -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__
|
||||
@@ -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 );
|
||||
|
||||
@@ -133,26 +133,29 @@ namespace WorldPackets
|
||||
class SaveEquipmentSet;
|
||||
}
|
||||
|
||||
namespace GameObject
|
||||
{
|
||||
class GameObjectReportUse;
|
||||
class GameObjectUse;
|
||||
}
|
||||
|
||||
namespace Guild
|
||||
{
|
||||
class QueryGuildInfo;
|
||||
}
|
||||
|
||||
namespace Spells
|
||||
namespace Item
|
||||
{
|
||||
class SpellCastRequest;
|
||||
class SetActionButton;
|
||||
class SplitItem;
|
||||
class SwapInvItem;
|
||||
class SwapItem;
|
||||
class AutoEquipItem;
|
||||
class DestroyItem;
|
||||
}
|
||||
|
||||
namespace Talent
|
||||
namespace Loot
|
||||
{
|
||||
class SetSpecialization;
|
||||
class LearnTalent;
|
||||
}
|
||||
|
||||
namespace Trade
|
||||
{
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user