mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Packets: converted SMSG_LOOT_LIST to packet class
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "Item.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
#include "LootPackets.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "MovementGenerator.h"
|
||||
@@ -11861,11 +11862,11 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
||||
|
||||
if (creature)
|
||||
{
|
||||
WorldPacket data2(SMSG_LOOT_LIST, 8 + 1 + 1);
|
||||
data2 << uint64(creature->GetGUID());
|
||||
data2 << uint8(0); // unk1
|
||||
data2 << uint8(0); // no group looter
|
||||
player->SendMessageToSet(&data2, true);
|
||||
WorldPackets::Loot::LootList lootList;
|
||||
lootList.Owner = creature->GetGUID();
|
||||
lootList.RoundRobinWinner = player->GetGUID();
|
||||
|
||||
player->SendMessageToSet(lootList.Write(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "LootMgr.h"
|
||||
#include "LootPackets.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -1015,20 +1016,17 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
|
||||
{
|
||||
ASSERT(creature);
|
||||
|
||||
WorldPacket data(SMSG_LOOT_LIST, (8+8));
|
||||
data << uint64(creature->GetGUID());
|
||||
WorldPackets::Loot::LootList lootList;
|
||||
|
||||
lootList.Owner = creature->GetGUID();
|
||||
|
||||
if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
|
||||
data << GetMasterLooterGuid().WriteAsPacked();
|
||||
else
|
||||
data << uint8(0);
|
||||
lootList.Master = GetMasterLooterGuid();
|
||||
|
||||
if (groupLooter)
|
||||
data << groupLooter->GetPackGUID();
|
||||
else
|
||||
data << uint8(0);
|
||||
lootList.RoundRobinWinner = groupLooter->GetGUID();
|
||||
|
||||
BroadcastPacket(&data, false);
|
||||
BroadcastPacket(lootList.Write(), false);
|
||||
}
|
||||
|
||||
void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject)
|
||||
@@ -1814,7 +1812,7 @@ void Group::UpdatePlayerOutOfRange(Player* player)
|
||||
}
|
||||
}
|
||||
|
||||
void Group::BroadcastAddonMessagePacket(WorldPacket* packet, const std::string& prefix, bool ignorePlayersInBGRaid, int group, uint64 ignore)
|
||||
void Group::BroadcastAddonMessagePacket(WorldPacket const* packet, const std::string& prefix, bool ignorePlayersInBGRaid, int group, uint64 ignore)
|
||||
{
|
||||
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
@@ -1829,7 +1827,7 @@ void Group::BroadcastAddonMessagePacket(WorldPacket* packet, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, ObjectGuid ignoredPlayer)
|
||||
void Group::BroadcastPacket(WorldPacket const* packet, bool ignorePlayersInBGRaid, int group, ObjectGuid ignoredPlayer)
|
||||
{
|
||||
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
@@ -1842,7 +1840,7 @@ void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int
|
||||
}
|
||||
}
|
||||
|
||||
void Group::BroadcastReadyCheck(WorldPacket* packet)
|
||||
void Group::BroadcastReadyCheck(WorldPacket const* packet)
|
||||
{
|
||||
for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
|
||||
@@ -334,9 +334,9 @@ class TC_GAME_API Group
|
||||
worker(itr->GetSource());
|
||||
}
|
||||
|
||||
void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignoredPlayer = ObjectGuid::Empty);
|
||||
void BroadcastAddonMessagePacket(WorldPacket* packet, const std::string& prefix, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0);
|
||||
void BroadcastReadyCheck(WorldPacket* packet);
|
||||
void BroadcastPacket(WorldPacket const* packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignoredPlayer = ObjectGuid::Empty);
|
||||
void BroadcastAddonMessagePacket(WorldPacket const* packet, const std::string& prefix, bool ignorePlayersInBGRaid, int group = -1, uint64 ignore = 0);
|
||||
void BroadcastReadyCheck(WorldPacket const* packet);
|
||||
void OfflineReadyCheck();
|
||||
|
||||
/*********************************************************/
|
||||
|
||||
27
src/server/game/Server/Packets/LootPackets.cpp
Normal file
27
src/server/game/Server/Packets/LootPackets.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* 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"
|
||||
|
||||
WorldPacket const* WorldPackets::Loot::LootList::Write()
|
||||
{
|
||||
_worldPacket << Owner;
|
||||
_worldPacket << Master.WriteAsPacked();
|
||||
_worldPacket << RoundRobinWinner.WriteAsPacked();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
43
src/server/game/Server/Packets/LootPackets.h
Normal file
43
src/server/game/Server/Packets/LootPackets.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* 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"
|
||||
#include "ObjectGuid.h"
|
||||
#include "ItemPacketsCommon.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Loot
|
||||
{
|
||||
class LootList final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
LootList() : ServerPacket(SMSG_LOOT_LIST, 8 + 8 + 8) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Owner;
|
||||
ObjectGuid Master;
|
||||
ObjectGuid RoundRobinWinner;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LootPackets_h__
|
||||
Reference in New Issue
Block a user