mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
111
This commit is contained in:
parent
8416702d7c
commit
2bf75e7a10
6 changed files with 26 additions and 24 deletions
|
|
@ -470,12 +470,11 @@ void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data )
|
||||||
sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" );
|
sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" );
|
||||||
|
|
||||||
uint32 itemid;
|
uint32 itemid;
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
|
|
||||||
recv_data >> itemid >> guid;
|
recv_data >> itemid >> guid;
|
||||||
|
|
||||||
sLog.outDetail( "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u",
|
sLog.outDetail( "Packet Info: itemid: %u guid: %s", itemid, guid.GetString().c_str());
|
||||||
itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,8 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||||
void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||||
{
|
{
|
||||||
uint8 slotid;
|
uint8 slotid;
|
||||||
uint64 lootguid, target_playerguid;
|
ObjectGuid lootguid;
|
||||||
|
ObjectGuid target_playerguid;
|
||||||
|
|
||||||
recv_data >> lootguid >> slotid >> target_playerguid;
|
recv_data >> lootguid >> slotid >> target_playerguid;
|
||||||
|
|
||||||
|
|
@ -476,18 +477,18 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, target_playerguid));
|
Player *target = ObjectAccessor::FindPlayer(target_playerguid);
|
||||||
if(!target)
|
if(!target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sLog.outDebug("WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName());
|
sLog.outDebug("WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = %s [%s].", target_playerguid.GetString().c_str(), target->GetName());
|
||||||
|
|
||||||
if(_player->GetLootGUID() != lootguid)
|
if(_player->GetLootGUID() != lootguid.GetRawValue())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Loot *pLoot = NULL;
|
Loot *pLoot = NULL;
|
||||||
|
|
||||||
if(IS_CREATURE_GUID(GetPlayer()->GetLootGUID()))
|
if(lootguid.IsCreature())
|
||||||
{
|
{
|
||||||
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
|
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
|
||||||
if(!pCreature)
|
if(!pCreature)
|
||||||
|
|
@ -495,7 +496,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
pLoot = &pCreature->loot;
|
pLoot = &pCreature->loot;
|
||||||
}
|
}
|
||||||
else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
|
else if(lootguid.IsGameobject())
|
||||||
{
|
{
|
||||||
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
|
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
|
||||||
if(!pGO)
|
if(!pGO)
|
||||||
|
|
@ -503,8 +504,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
pLoot = &pGO->loot;
|
pLoot = &pGO->loot;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if(!pLoot)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (slotid > pLoot->items.size())
|
if (slotid > pLoot->items.size())
|
||||||
|
|
|
||||||
|
|
@ -288,7 +288,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
||||||
|
|
||||||
uint32 gossipListId;
|
uint32 gossipListId;
|
||||||
uint32 menuId;
|
uint32 menuId;
|
||||||
uint64 guid;
|
ObjectGuid guid;
|
||||||
std::string code = "";
|
std::string code = "";
|
||||||
|
|
||||||
recv_data >> guid >> menuId >> gossipListId;
|
recv_data >> guid >> menuId >> gossipListId;
|
||||||
|
|
@ -305,13 +305,13 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
||||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
// can vehicle have gossip? If so, need check for this also.
|
// can vehicle have gossip? If so, need check for this also.
|
||||||
if (IS_CREATURE_OR_PET_GUID(guid))
|
if (guid.IsCreatureOrPet())
|
||||||
{
|
{
|
||||||
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||||
|
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - Creature (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
|
sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - %s not found or you can't interact with it.", guid.GetString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -326,13 +326,13 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
|
||||||
_player->OnGossipSelect(pCreature, gossipListId, menuId);
|
_player->OnGossipSelect(pCreature, gossipListId, menuId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IS_GAMEOBJECT_GUID(guid))
|
else if (guid.IsGameobject())
|
||||||
{
|
{
|
||||||
GameObject *pGo = GetPlayer()->GetGameObjectIfCanInteractWith(guid);
|
GameObject *pGo = GetPlayer()->GetGameObjectIfCanInteractWith(guid);
|
||||||
|
|
||||||
if (!pGo)
|
if (!pGo)
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
|
sLog.outDebug("WORLD: HandleGossipSelectOptionOpcode - %s not found or you can't interact with it.", guid.GetString().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,8 @@ enum HighGuid
|
||||||
//*** Must be replaced by ObjectGuid use ***
|
//*** Must be replaced by ObjectGuid use ***
|
||||||
#define IS_CREATURE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_UNIT )
|
#define IS_CREATURE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_UNIT )
|
||||||
#define IS_PET_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_PET )
|
#define IS_PET_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_PET )
|
||||||
#define IS_CREATURE_OR_PET_GUID(Guid)( IS_CREATURE_GUID(Guid) || IS_PET_GUID(Guid) )
|
|
||||||
#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_GUID(Guid) || IS_PET_GUID(Guid) || IS_PLAYER_GUID(Guid) )
|
||||||
// special case for empty guid need check
|
// special case for empty guid need check
|
||||||
#define IS_GAMEOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT )
|
#define IS_GAMEOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT )
|
||||||
#define IS_MO_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT )
|
#define IS_MO_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT )
|
||||||
|
|
|
||||||
|
|
@ -2124,10 +2124,10 @@ void Player::RegenerateHealth(uint32 diff)
|
||||||
ModifyHealth(int32(addvalue));
|
ModifyHealth(int32(addvalue));
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
|
Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
|
||||||
{
|
{
|
||||||
// unit checks
|
// some basic checks
|
||||||
if (!guid || !IsInWorld() || isInFlight())
|
if (guid.IsEmpty() || !IsInWorld() || isInFlight())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// exist (we need look pets also for some interaction (quest/etc)
|
// exist (we need look pets also for some interaction (quest/etc)
|
||||||
|
|
@ -2174,8 +2174,12 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, uint32 gameobject_type) const
|
GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, uint32 gameobject_type) const
|
||||||
{
|
{
|
||||||
|
// some basic checks
|
||||||
|
if (guid.IsEmpty() || !IsInWorld() || isInFlight())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (GameObject *go = GetMap()->GetGameObject(guid))
|
if (GameObject *go = GetMap()->GetGameObject(guid))
|
||||||
{
|
{
|
||||||
if (uint32(go->GetGoType()) == gameobject_type || gameobject_type == MAX_GAMEOBJECT_TYPE)
|
if (uint32(go->GetGoType()) == gameobject_type || gameobject_type == MAX_GAMEOBJECT_TYPE)
|
||||||
|
|
|
||||||
|
|
@ -1048,8 +1048,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0);
|
void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0);
|
||||||
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
|
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
|
||||||
|
|
||||||
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
|
Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask);
|
||||||
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, uint32 gameobject_type = MAX_GAMEOBJECT_TYPE) const;
|
GameObject* GetGameObjectIfCanInteractWith(ObjectGuid guid, uint32 gameobject_type = MAX_GAMEOBJECT_TYPE) const;
|
||||||
|
|
||||||
void UpdateVisibilityForPlayer();
|
void UpdateVisibilityForPlayer();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue