mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[9579] Use ObjectGuid in some loot code.
Also use ObjectGuidSet instead std::set<ObjectGuid>
This commit is contained in:
parent
acde81fc54
commit
8416702d7c
13 changed files with 447 additions and 428 deletions
|
|
@ -94,7 +94,7 @@ VisibleNotifier::Notify()
|
||||||
|
|
||||||
// generate outOfRange for not iterate objects
|
// generate outOfRange for not iterate objects
|
||||||
i_data.AddOutOfRangeGUID(i_clientGUIDs);
|
i_data.AddOutOfRangeGUID(i_clientGUIDs);
|
||||||
for(Player::ClientGUIDs::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr)
|
for(ObjectGuidSet::iterator itr = i_clientGUIDs.begin();itr!=i_clientGUIDs.end();++itr)
|
||||||
{
|
{
|
||||||
i_player.m_clientGUIDs.erase(*itr);
|
i_player.m_clientGUIDs.erase(*itr);
|
||||||
|
|
||||||
|
|
@ -123,8 +123,8 @@ VisibleNotifier::Notify()
|
||||||
i_player.GetSession()->SendPacket(&packet);
|
i_player.GetSession()->SendPacket(&packet);
|
||||||
|
|
||||||
// send out of range to other players if need
|
// send out of range to other players if need
|
||||||
std::set<ObjectGuid> const& oor = i_data.GetOutOfRangeGUIDs();
|
ObjectGuidSet const& oor = i_data.GetOutOfRangeGUIDs();
|
||||||
for(std::set<ObjectGuid>::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
|
for(ObjectGuidSet::const_iterator iter = oor.begin(); iter != oor.end(); ++iter)
|
||||||
{
|
{
|
||||||
if(!iter->IsPlayer())
|
if(!iter->IsPlayer())
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace MaNGOS
|
||||||
Player &i_player;
|
Player &i_player;
|
||||||
UpdateData i_data;
|
UpdateData i_data;
|
||||||
UpdateDataMapType i_data_updates;
|
UpdateDataMapType i_data_updates;
|
||||||
Player::ClientGUIDs i_clientGUIDs;
|
ObjectGuidSet i_clientGUIDs;
|
||||||
std::set<WorldObject*> i_visibleNow;
|
std::set<WorldObject*> i_visibleNow;
|
||||||
|
|
||||||
explicit VisibleNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {}
|
explicit VisibleNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {}
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,15 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
sLog.outDebug("WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
||||||
Player *player = GetPlayer();
|
Player *player = GetPlayer();
|
||||||
uint64 lguid = player->GetLootGUID();
|
ObjectGuid lguid = player->GetLootGUID();
|
||||||
Loot *loot;
|
Loot *loot;
|
||||||
uint8 lootSlot;
|
uint8 lootSlot;
|
||||||
|
|
||||||
recv_data >> lootSlot;
|
recv_data >> lootSlot;
|
||||||
|
|
||||||
if (IS_GAMEOBJECT_GUID(lguid))
|
switch( lguid.GetHigh())
|
||||||
|
{
|
||||||
|
case HIGHGUID_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
GameObject *go = player->GetMap()->GetGameObject(lguid);
|
GameObject *go = player->GetMap()->GetGameObject(lguid);
|
||||||
|
|
||||||
|
|
@ -53,8 +55,9 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
|
|
||||||
loot = &go->loot;
|
loot = &go->loot;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (IS_ITEM_GUID(lguid))
|
case HIGHGUID_ITEM:
|
||||||
{
|
{
|
||||||
Item *pItem = player->GetItemByGuid( lguid );
|
Item *pItem = player->GetItemByGuid( lguid );
|
||||||
|
|
||||||
|
|
@ -65,8 +68,9 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
|
|
||||||
loot = &pItem->loot;
|
loot = &pItem->loot;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (IS_CORPSE_GUID(lguid))
|
case HIGHGUID_CORPSE:
|
||||||
{
|
{
|
||||||
Corpse *bones = player->GetMap()->GetCorpse(lguid);
|
Corpse *bones = player->GetMap()->GetCorpse(lguid);
|
||||||
if (!bones)
|
if (!bones)
|
||||||
|
|
@ -75,8 +79,9 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loot = &bones->loot;
|
loot = &bones->loot;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
case HIGHGUID_UNIT:
|
||||||
{
|
{
|
||||||
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
|
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
|
||||||
|
|
||||||
|
|
@ -89,6 +94,13 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
|
|
||||||
loot = &pCreature->loot;
|
loot = &pCreature->loot;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
sLog.outError("%s is unsupported for looting.",lguid.GetString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QuestItem *qitem = NULL;
|
QuestItem *qitem = NULL;
|
||||||
|
|
@ -162,13 +174,13 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
||||||
sLog.outDebug("WORLD: CMSG_LOOT_MONEY");
|
sLog.outDebug("WORLD: CMSG_LOOT_MONEY");
|
||||||
|
|
||||||
Player *player = GetPlayer();
|
Player *player = GetPlayer();
|
||||||
uint64 guid = player->GetLootGUID();
|
ObjectGuid guid = player->GetLootGUID();
|
||||||
if(!guid)
|
if (guid.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Loot *pLoot = NULL;
|
Loot *pLoot = NULL;
|
||||||
|
|
||||||
switch(GUID_HIPART(guid))
|
switch(guid.GetHigh())
|
||||||
{
|
{
|
||||||
case HIGHGUID_GAMEOBJECT:
|
case HIGHGUID_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
|
|
@ -210,9 +222,9 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
||||||
return; // unlootable type
|
return; // unlootable type
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pLoot )
|
if (pLoot)
|
||||||
{
|
{
|
||||||
if (!IS_ITEM_GUID(guid) && player->GetGroup()) //item can be looted only single player
|
if (!guid.IsItem() && player->GetGroup()) //item can be looted only single player
|
||||||
{
|
{
|
||||||
Group *group = player->GetGroup();
|
Group *group = player->GetGroup();
|
||||||
|
|
||||||
|
|
@ -274,7 +286,7 @@ void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
|
||||||
DoLootRelease(lguid);
|
DoLootRelease(lguid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::DoLootRelease( uint64 lguid )
|
void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||||
{
|
{
|
||||||
Player *player = GetPlayer();
|
Player *player = GetPlayer();
|
||||||
Loot *loot;
|
Loot *loot;
|
||||||
|
|
@ -287,7 +299,9 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
||||||
if(!player->IsInWorld())
|
if(!player->IsInWorld())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IS_GAMEOBJECT_GUID(lguid))
|
switch(lguid.GetHigh())
|
||||||
|
{
|
||||||
|
case HIGHGUID_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
|
GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
|
||||||
|
|
||||||
|
|
@ -366,8 +380,9 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
||||||
else
|
else
|
||||||
// not fully looted object
|
// not fully looted object
|
||||||
go->SetLootState(GO_ACTIVATED);
|
go->SetLootState(GO_ACTIVATED);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
|
case HIGHGUID_CORPSE: // ONLY remove insignia at BG
|
||||||
{
|
{
|
||||||
Corpse *corpse = _player->GetMap()->GetCorpse(lguid);
|
Corpse *corpse = _player->GetMap()->GetCorpse(lguid);
|
||||||
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
||||||
|
|
@ -380,8 +395,9 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
||||||
loot->clear();
|
loot->clear();
|
||||||
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
|
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (IS_ITEM_GUID(lguid))
|
case HIGHGUID_ITEM:
|
||||||
{
|
{
|
||||||
Item *pItem = player->GetItemByGuid(lguid );
|
Item *pItem = player->GetItemByGuid(lguid );
|
||||||
if(!pItem)
|
if(!pItem)
|
||||||
|
|
@ -409,7 +425,7 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
||||||
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
|
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
|
||||||
return; // item can be looted only single player
|
return; // item can be looted only single player
|
||||||
}
|
}
|
||||||
else
|
case HIGHGUID_UNIT:
|
||||||
{
|
{
|
||||||
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
|
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
|
||||||
|
|
||||||
|
|
@ -434,6 +450,13 @@ void WorldSession::DoLootRelease( uint64 lguid )
|
||||||
pCreature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
pCreature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||||
loot->clear();
|
loot->clear();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
sLog.outError("%s is unsupported for looting.", lguid.GetString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Player is not looking at loot list, he doesn't need to see updates on the loot list
|
//Player is not looking at loot list, he doesn't need to see updates on the loot list
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,7 @@ enum HighGuid
|
||||||
#define IS_PLAYER_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_PLAYER && Guid!=0 )
|
#define IS_PLAYER_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_PLAYER && Guid!=0 )
|
||||||
#define IS_UNIT_GUID(Guid) ( IS_CREATURE_OR_PET_GUID(Guid) || IS_PLAYER_GUID(Guid) )
|
#define IS_UNIT_GUID(Guid) ( IS_CREATURE_OR_PET_GUID(Guid) || IS_PLAYER_GUID(Guid) )
|
||||||
// special case for empty guid need check
|
// special case for empty guid need check
|
||||||
#define IS_ITEM_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_ITEM )
|
|
||||||
#define IS_GAMEOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT )
|
#define IS_GAMEOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT )
|
||||||
#define IS_CORPSE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_CORPSE )
|
|
||||||
#define IS_MO_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT )
|
#define IS_MO_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT )
|
||||||
|
|
||||||
// l - OBJECT_FIELD_GUID
|
// l - OBJECT_FIELD_GUID
|
||||||
|
|
@ -233,6 +231,8 @@ class ObjectGuid
|
||||||
uint64 m_guid;
|
uint64 m_guid;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::set<ObjectGuid> ObjectGuidSet;
|
||||||
|
|
||||||
class PackedGuid
|
class PackedGuid
|
||||||
{
|
{
|
||||||
friend ByteBuffer& operator<< (ByteBuffer& buf, PackedGuid const& guid);
|
friend ByteBuffer& operator<< (ByteBuffer& buf, PackedGuid const& guid);
|
||||||
|
|
|
||||||
|
|
@ -7533,14 +7533,15 @@ void Player::RemovedInsignia(Player* looterPlr)
|
||||||
looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
|
looterPlr->SendLoot(bones->GetGUID(), LOOT_INSIGNIA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SendLootRelease( uint64 guid )
|
void Player::SendLootRelease(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
WorldPacket data( SMSG_LOOT_RELEASE_RESPONSE, (8+1) );
|
WorldPacket data( SMSG_LOOT_RELEASE_RESPONSE, (8+1) );
|
||||||
data << uint64(guid) << uint8(1);
|
data << guid;
|
||||||
|
data << uint8(1);
|
||||||
SendDirectMessage( &data );
|
SendDirectMessage( &data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SendLoot(uint64 guid, LootType loot_type)
|
void Player::SendLoot(ObjectGuid guid, LootType loot_type)
|
||||||
{
|
{
|
||||||
if (uint64 lguid = GetLootGUID())
|
if (uint64 lguid = GetLootGUID())
|
||||||
m_session->DoLootRelease(lguid);
|
m_session->DoLootRelease(lguid);
|
||||||
|
|
@ -7549,7 +7550,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
PermissionTypes permission = ALL_PERMISSION;
|
PermissionTypes permission = ALL_PERMISSION;
|
||||||
|
|
||||||
sLog.outDebug("Player::SendLoot");
|
sLog.outDebug("Player::SendLoot");
|
||||||
if (IS_GAMEOBJECT_GUID(guid))
|
switch(guid.GetHigh())
|
||||||
|
{
|
||||||
|
case HIGHGUID_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
sLog.outDebug(" IS_GAMEOBJECT_GUID(guid)");
|
sLog.outDebug(" IS_GAMEOBJECT_GUID(guid)");
|
||||||
GameObject *go = GetMap()->GetGameObject(guid);
|
GameObject *go = GetMap()->GetGameObject(guid);
|
||||||
|
|
@ -7588,8 +7591,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
|
|
||||||
go->SetLootState(GO_ACTIVATED);
|
go->SetLootState(GO_ACTIVATED);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (IS_ITEM_GUID(guid))
|
case HIGHGUID_ITEM:
|
||||||
{
|
{
|
||||||
Item *item = GetItemByGuid( guid );
|
Item *item = GetItemByGuid( guid );
|
||||||
|
|
||||||
|
|
@ -7623,8 +7627,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (IS_CORPSE_GUID(guid)) // remove insignia
|
case HIGHGUID_CORPSE: // remove insignia
|
||||||
{
|
{
|
||||||
Corpse *bones = GetMap()->GetCorpse(guid);
|
Corpse *bones = GetMap()->GetCorpse(guid);
|
||||||
|
|
||||||
|
|
@ -7650,8 +7655,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
|
|
||||||
if (bones->lootRecipient != this)
|
if (bones->lootRecipient != this)
|
||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
case HIGHGUID_UNIT:
|
||||||
{
|
{
|
||||||
Creature *creature = GetMap()->GetCreature(guid);
|
Creature *creature = GetMap()->GetCreature(guid);
|
||||||
|
|
||||||
|
|
@ -7768,6 +7774,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
permission = NONE_PERMISSION;
|
permission = NONE_PERMISSION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
sLog.outError("%s is unsupported for looting.", guid.GetString().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLootGUID(guid);
|
SetLootGUID(guid);
|
||||||
|
|
@ -7785,7 +7798,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
|
|
||||||
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
|
WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size
|
||||||
|
|
||||||
data << uint64(guid);
|
data << guid;
|
||||||
data << uint8(loot_type);
|
data << uint8(loot_type);
|
||||||
data << LootView(*loot, this, permission);
|
data << LootView(*loot, this, permission);
|
||||||
|
|
||||||
|
|
@ -7795,7 +7808,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
||||||
if (permission != NONE_PERMISSION)
|
if (permission != NONE_PERMISSION)
|
||||||
loot->AddLooter(GetGUID());
|
loot->AddLooter(GetGUID());
|
||||||
|
|
||||||
if (loot_type == LOOT_CORPSE && !IS_ITEM_GUID(guid))
|
if (loot_type == LOOT_CORPSE && !guid.IsItem())
|
||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8670,47 +8683,31 @@ Item* Player::GetItemByLimitedCategory(uint32 limitedCategory) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* Player::GetItemByGuid( uint64 guid ) const
|
Item* Player::GetItemByGuid(ObjectGuid guid) const
|
||||||
{
|
{
|
||||||
for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
|
for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
|
||||||
{
|
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||||
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
|
if (pItem->GetGUID() == guid.GetRawValue())
|
||||||
if( pItem && pItem->GetGUID() == guid )
|
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
|
||||||
for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
|
for(int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
|
||||||
{
|
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||||
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
|
if (pItem->GetGUID() == guid.GetRawValue())
|
||||||
if( pItem && pItem->GetGUID() == guid )
|
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||||
{
|
if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||||
Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i );
|
|
||||||
if( pBag )
|
|
||||||
{
|
|
||||||
for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
|
for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
|
||||||
{
|
if (Item* pItem = pBag->GetItemByPos(j))
|
||||||
Item* pItem = pBag->GetItemByPos( j );
|
if (pItem->GetGUID() == guid.GetRawValue())
|
||||||
if( pItem && pItem->GetGUID() == guid )
|
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
|
for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
|
||||||
{
|
if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
|
||||||
Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i );
|
|
||||||
if( pBag )
|
|
||||||
{
|
|
||||||
for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
|
for(uint32 j = 0; j < pBag->GetBagSize(); ++j)
|
||||||
{
|
if (Item* pItem = pBag->GetItemByPos(j))
|
||||||
Item* pItem = pBag->GetItemByPos( j );
|
if (pItem->GetGUID() == guid.GetRawValue())
|
||||||
if( pItem && pItem->GetGUID() == guid )
|
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -18876,13 +18873,13 @@ void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* targe
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void UpdateVisibilityOf_helper(std::set<ObjectGuid>& s64, T* target)
|
inline void UpdateVisibilityOf_helper(ObjectGuidSet& s64, T* target)
|
||||||
{
|
{
|
||||||
s64.insert(target->GetGUID());
|
s64.insert(target->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void UpdateVisibilityOf_helper(std::set<ObjectGuid>& s64, GameObject* target)
|
inline void UpdateVisibilityOf_helper(ObjectGuidSet& s64, GameObject* target)
|
||||||
{
|
{
|
||||||
if(!target->IsTransport())
|
if(!target->IsTransport())
|
||||||
s64.insert(target->GetGUID());
|
s64.insert(target->GetGUID());
|
||||||
|
|
@ -19529,7 +19526,7 @@ void Player::UpdateForQuestWorldObjects()
|
||||||
|
|
||||||
UpdateData udata;
|
UpdateData udata;
|
||||||
WorldPacket packet;
|
WorldPacket packet;
|
||||||
for(ClientGUIDs::const_iterator itr=m_clientGUIDs.begin(); itr!=m_clientGUIDs.end(); ++itr)
|
for(ObjectGuidSet::const_iterator itr=m_clientGUIDs.begin(); itr!=m_clientGUIDs.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (itr->IsGameobject())
|
if (itr->IsGameobject())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1149,7 +1149,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
uint8 FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const;
|
uint8 FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const;
|
||||||
uint32 GetItemCount( uint32 item, bool inBankAlso = false, Item* skipItem = NULL ) const;
|
uint32 GetItemCount( uint32 item, bool inBankAlso = false, Item* skipItem = NULL ) const;
|
||||||
uint32 GetItemCountWithLimitCategory(uint32 limitCategory) const;
|
uint32 GetItemCountWithLimitCategory(uint32 limitCategory) const;
|
||||||
Item* GetItemByGuid( uint64 guid ) const;
|
Item* GetItemByGuid(ObjectGuid uint64) const;
|
||||||
Item* GetItemByEntry(uint32 item) const; // only for special cases
|
Item* GetItemByEntry(uint32 item) const; // only for special cases
|
||||||
Item* GetItemByLimitedCategory(uint32 limitedCategory) const;
|
Item* GetItemByLimitedCategory(uint32 limitedCategory) const;
|
||||||
Item* GetItemByPos( uint16 pos ) const;
|
Item* GetItemByPos( uint16 pos ) const;
|
||||||
|
|
@ -1789,8 +1789,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void ApplyManaRegenBonus(int32 amount, bool apply);
|
void ApplyManaRegenBonus(int32 amount, bool apply);
|
||||||
void UpdateManaRegen();
|
void UpdateManaRegen();
|
||||||
|
|
||||||
const uint64& GetLootGUID() const { return m_lootGuid; }
|
const uint64& GetLootGUID() const { return m_lootGuid.GetRawValue(); }
|
||||||
void SetLootGUID(const uint64 &guid) { m_lootGuid = guid; }
|
void SetLootGUID(ObjectGuid const& guid) { m_lootGuid = guid; }
|
||||||
|
|
||||||
void RemovedInsignia(Player* looterPlr);
|
void RemovedInsignia(Player* looterPlr);
|
||||||
|
|
||||||
|
|
@ -1985,8 +1985,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
PlayerMenu* PlayerTalkClass;
|
PlayerMenu* PlayerTalkClass;
|
||||||
std::vector<ItemSetEffect *> ItemSetEff;
|
std::vector<ItemSetEffect *> ItemSetEff;
|
||||||
|
|
||||||
void SendLoot(uint64 guid, LootType loot_type);
|
void SendLoot(ObjectGuid guid, LootType loot_type);
|
||||||
void SendLootRelease( uint64 guid );
|
void SendLootRelease(ObjectGuid guid );
|
||||||
void SendNotifyLootItemRemoved(uint8 lootSlot);
|
void SendNotifyLootItemRemoved(uint8 lootSlot);
|
||||||
void SendNotifyLootMoneyRemoved();
|
void SendNotifyLootMoneyRemoved();
|
||||||
|
|
||||||
|
|
@ -2178,8 +2178,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
Object* GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask);
|
Object* GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask);
|
||||||
|
|
||||||
// currently visible objects at player client
|
// currently visible objects at player client
|
||||||
typedef std::set<ObjectGuid> ClientGUIDs;
|
ObjectGuidSet m_clientGUIDs;
|
||||||
ClientGUIDs m_clientGUIDs;
|
|
||||||
|
|
||||||
bool HaveAtClient(WorldObject const* u) { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); }
|
bool HaveAtClient(WorldObject const* u) { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); }
|
||||||
|
|
||||||
|
|
@ -2375,7 +2374,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
time_t m_lastHonorUpdateTime;
|
time_t m_lastHonorUpdateTime;
|
||||||
|
|
||||||
void outDebugValues() const;
|
void outDebugValues() const;
|
||||||
uint64 m_lootGuid;
|
ObjectGuid m_lootGuid;
|
||||||
|
|
||||||
uint32 m_team;
|
uint32 m_team;
|
||||||
uint32 m_nextSave;
|
uint32 m_nextSave;
|
||||||
|
|
|
||||||
|
|
@ -639,7 +639,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
||||||
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
|
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
|
||||||
data << uint32(count); // placeholder
|
data << uint32(count); // placeholder
|
||||||
|
|
||||||
for(Player::ClientGUIDs::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
|
for(ObjectGuidSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
|
||||||
{
|
{
|
||||||
uint8 questStatus = DIALOG_STATUS_NONE;
|
uint8 questStatus = DIALOG_STATUS_NONE;
|
||||||
uint8 defstatus = DIALOG_STATUS_NONE;
|
uint8 defstatus = DIALOG_STATUS_NONE;
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ void SpellCastTargets::Update(Unit* caster)
|
||||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
if(m_targetMask & TARGET_FLAG_ITEM)
|
if(m_targetMask & TARGET_FLAG_ITEM)
|
||||||
m_itemTarget = ((Player*)caster)->GetItemByGuid(m_itemTargetGUID.GetRawValue());
|
m_itemTarget = ((Player*)caster)->GetItemByGuid(m_itemTargetGUID);
|
||||||
else if(m_targetMask & TARGET_FLAG_TRADE_ITEM)
|
else if(m_targetMask & TARGET_FLAG_TRADE_ITEM)
|
||||||
{
|
{
|
||||||
Player* pTrader = ((Player*)caster)->GetTrader();
|
Player* pTrader = ((Player*)caster)->GetTrader();
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ UpdateData::UpdateData() : m_blockCount(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateData::AddOutOfRangeGUID(std::set<ObjectGuid>& guids)
|
void UpdateData::AddOutOfRangeGUID(ObjectGuidSet& guids)
|
||||||
{
|
{
|
||||||
m_outOfRangeGUIDs.insert(guids.begin(),guids.end());
|
m_outOfRangeGUIDs.insert(guids.begin(),guids.end());
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +115,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet)
|
||||||
buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS;
|
buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS;
|
||||||
buf << (uint32) m_outOfRangeGUIDs.size();
|
buf << (uint32) m_outOfRangeGUIDs.size();
|
||||||
|
|
||||||
for(std::set<ObjectGuid>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
|
for(ObjectGuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
|
||||||
buf << i->WriteAsPacked();
|
buf << i->WriteAsPacked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@
|
||||||
#define __UPDATEDATA_H
|
#define __UPDATEDATA_H
|
||||||
|
|
||||||
#include "ByteBuffer.h"
|
#include "ByteBuffer.h"
|
||||||
|
#include "ObjectGuid.h"
|
||||||
|
|
||||||
class WorldPacket;
|
class WorldPacket;
|
||||||
class ObjectGuid;
|
|
||||||
|
|
||||||
enum OBJECT_UPDATE_TYPE
|
enum OBJECT_UPDATE_TYPE
|
||||||
{
|
{
|
||||||
|
|
@ -54,18 +54,18 @@ class UpdateData
|
||||||
public:
|
public:
|
||||||
UpdateData();
|
UpdateData();
|
||||||
|
|
||||||
void AddOutOfRangeGUID(std::set<ObjectGuid>& guids);
|
void AddOutOfRangeGUID(ObjectGuidSet& guids);
|
||||||
void AddOutOfRangeGUID(ObjectGuid const &guid);
|
void AddOutOfRangeGUID(ObjectGuid const &guid);
|
||||||
void AddUpdateBlock(const ByteBuffer &block);
|
void AddUpdateBlock(const ByteBuffer &block);
|
||||||
bool BuildPacket(WorldPacket *packet);
|
bool BuildPacket(WorldPacket *packet);
|
||||||
bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
|
bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
std::set<ObjectGuid> const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
|
ObjectGuidSet const& GetOutOfRangeGUIDs() const { return m_outOfRangeGUIDs; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32 m_blockCount;
|
uint32 m_blockCount;
|
||||||
std::set<ObjectGuid> m_outOfRangeGUIDs;
|
ObjectGuidSet m_outOfRangeGUIDs;
|
||||||
ByteBuffer m_data;
|
ByteBuffer m_data;
|
||||||
|
|
||||||
void Compress(void* dst, uint32 *dst_size, void* src, int src_size);
|
void Compress(void* dst, uint32 *dst_size, void* src, int src_size);
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ class MANGOS_DLL_SPEC WorldSession
|
||||||
|
|
||||||
void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data);
|
void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data);
|
||||||
|
|
||||||
void DoLootRelease( uint64 lguid );
|
void DoLootRelease(ObjectGuid lguid);
|
||||||
|
|
||||||
// Account mute time
|
// Account mute time
|
||||||
time_t m_muteTime;
|
time_t m_muteTime;
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,7 @@ bool ChatHandler::HandleDebugGetItemValueCommand(const char* args)
|
||||||
uint32 guid = (uint32)atoi(e);
|
uint32 guid = (uint32)atoi(e);
|
||||||
uint32 index = (uint32)atoi(f);
|
uint32 index = (uint32)atoi(f);
|
||||||
|
|
||||||
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
|
Item *i = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||||
|
|
||||||
if (!i)
|
if (!i)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -723,7 +723,7 @@ bool ChatHandler::HandleDebugSetItemValueCommand(const char* args)
|
||||||
uint32 index = (uint32)atoi(f);
|
uint32 index = (uint32)atoi(f);
|
||||||
uint32 value = (uint32)atoi(g);
|
uint32 value = (uint32)atoi(g);
|
||||||
|
|
||||||
Item *i = m_session->GetPlayer()->GetItemByGuid(MAKE_NEW_GUID(guid, 0, HIGHGUID_ITEM));
|
Item *i = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||||
|
|
||||||
if (!i)
|
if (!i)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9578"
|
#define REVISION_NR "9579"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue