Skip to content

Commit

Permalink
111
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed Mar 13, 2010
1 parent 6e24375 commit 6451683
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
5 changes: 2 additions & 3 deletions src/game/ItemHandler.cpp
Expand Up @@ -470,12 +470,11 @@ void WorldSession::HandlePageQuerySkippedOpcode( WorldPacket & recv_data )
sLog.outDebug( "WORLD: Received CMSG_PAGE_TEXT_QUERY" );

uint32 itemid;
uint64 guid;
ObjectGuid guid;

recv_data >> itemid >> guid;

sLog.outDetail( "Packet Info: itemid: %u guidlow: %u guidentry: %u guidhigh: %u",
itemid, GUID_LOPART(guid), GUID_ENPART(guid), GUID_HIPART(guid));
sLog.outDetail( "Packet Info: itemid: %u guid: %s", itemid, guid.GetString().c_str());
}

void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
Expand Down
16 changes: 8 additions & 8 deletions src/game/LootHandler.cpp
Expand Up @@ -466,7 +466,8 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
{
uint8 slotid;
uint64 lootguid, target_playerguid;
ObjectGuid lootguid;
ObjectGuid target_playerguid;

recv_data >> lootguid >> slotid >> target_playerguid;

Expand All @@ -476,35 +477,34 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
return;
}

Player *target = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, target_playerguid));
Player *target = ObjectAccessor::FindPlayer(target_playerguid);
if(!target)
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;

Loot *pLoot = NULL;

if(IS_CREATURE_GUID(GetPlayer()->GetLootGUID()))
if(lootguid.IsCreature())
{
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
if(!pCreature)
return;

pLoot = &pCreature->loot;
}
else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
else if(lootguid.IsGameobject())
{
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
if(!pGO)
return;

pLoot = &pGO->loot;
}

if(!pLoot)
else
return;

if (slotid > pLoot->items.size())
Expand Down
10 changes: 5 additions & 5 deletions src/game/NPCHandler.cpp
Expand Up @@ -288,7 +288,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )

uint32 gossipListId;
uint32 menuId;
uint64 guid;
ObjectGuid guid;
std::string code = "";

recv_data >> guid >> menuId >> gossipListId;
Expand All @@ -305,13 +305,13 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);

// 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);

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;
}

Expand All @@ -326,13 +326,13 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
_player->OnGossipSelect(pCreature, gossipListId, menuId);
}
}
else if (IS_GAMEOBJECT_GUID(guid))
else if (guid.IsGameobject())
{
GameObject *pGo = GetPlayer()->GetGameObjectIfCanInteractWith(guid);

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;
}

Expand Down
3 changes: 1 addition & 2 deletions src/game/ObjectGuid.h
Expand Up @@ -71,9 +71,8 @@ enum HighGuid
//*** Must be replaced by ObjectGuid use ***
#define IS_CREATURE_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_UNIT )
#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_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
#define IS_GAMEOBJECT_GUID(Guid) ( GUID_HIPART(Guid) == HIGHGUID_GAMEOBJECT )
#define IS_MO_TRANSPORT(Guid) ( GUID_HIPART(Guid) == HIGHGUID_MO_TRANSPORT )
Expand Down
12 changes: 8 additions & 4 deletions src/game/Player.cpp
Expand Up @@ -2124,10 +2124,10 @@ void Player::RegenerateHealth(uint32 diff)
ModifyHealth(int32(addvalue));
}

Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
{
// unit checks
if (!guid || !IsInWorld() || isInFlight())
// some basic checks
if (guid.IsEmpty() || !IsInWorld() || isInFlight())
return NULL;

// exist (we need look pets also for some interaction (quest/etc)
Expand Down Expand Up @@ -2174,8 +2174,12 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
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 (uint32(go->GetGoType()) == gameobject_type || gameobject_type == MAX_GAMEOBJECT_TYPE)
Expand Down
4 changes: 2 additions & 2 deletions src/game/Player.h
Expand Up @@ -1048,8 +1048,8 @@ class MANGOS_DLL_SPEC Player : public Unit
void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0);
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);

Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, uint32 gameobject_type = MAX_GAMEOBJECT_TYPE) const;
Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask);
GameObject* GetGameObjectIfCanInteractWith(ObjectGuid guid, uint32 gameobject_type = MAX_GAMEOBJECT_TYPE) const;

void UpdateVisibilityForPlayer();

Expand Down

8 comments on commit 6451683

@LordJZ
Copy link
Contributor

@LordJZ LordJZ commented on 6451683 Mar 13, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL commit

@unloading
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, Vladimir got enraged for few following commits.... again ;=))
Nerve damage inflicted by typos can't be resisted/absorbed/mitigated in any way :(

@boxa
Copy link
Contributor

@boxa boxa commented on 6451683 Mar 13, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry gyus, Vladimir always make the best things. ))
Very respected to you........................

@boxa
Copy link
Contributor

@boxa boxa commented on 6451683 Mar 13, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эхх, хорошего настроения тёзка!!!

@boxa
Copy link
Contributor

@boxa boxa commented on 6451683 Mar 13, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But anyway - Vehicles in official MaNGOS code !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Sorry for emotion..........................

@boxa
Copy link
Contributor

@boxa boxa commented on 6451683 Mar 13, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Володя, ну почему эти долбанные машинки (vehicles) не реализовать? На Трине уже фиг знает сколько времени работает... И у меня портировано из их корявого кода давным давно... С Трини. Нафига? MaNGOS у нас самый крутой и лучший... Работает всё, никаких глюков/ошибок нет.. Пришлось конечно код подправить, но всё нормально сейчас. Как это было ещё с 31 если я не ошибаюсь. Ну возьмите готовый код (с Трини патч) и подправьте как Вам нравится )). Ну базовая вобщем-то фича... Куча и ДК КВ и Ледяной Короны на этом завязана. А вы её игнорируете. Возьмитесь и сделайте раз и навсегда!
Всё-равно всего хорошего!!!!!!!!

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just forgot merge with next commit before push....

@RangerRU
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boxa,
=)

Please sign in to comment.