diff options
Diffstat (limited to 'src/server/game/Handlers/NPCHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/NPCHandler.cpp | 75 |
1 files changed, 33 insertions, 42 deletions
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 1311cda1ef9..d402cdd265e 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -50,13 +50,13 @@ enum StableResultCode void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -67,7 +67,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData) SendTabardVendorActivate(guid); } -void WorldSession::SendTabardVendorActivate(uint64 guid) +void WorldSession::SendTabardVendorActivate(ObjectGuid guid) { WorldPacket data(MSG_TABARDVENDOR_ACTIVATE, 8); data << guid; @@ -76,7 +76,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid) void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE"); @@ -85,7 +85,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -96,7 +96,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) SendShowBank(guid); } -void WorldSession::SendShowBank(uint64 guid) +void WorldSession::SendShowBank(ObjectGuid guid) { WorldPacket data(SMSG_SHOW_BANK, 8); data << guid; @@ -104,7 +104,7 @@ void WorldSession::SendShowBank(uint64 guid) SendPacket(&data); } -void WorldSession::SendShowMailBox(uint64 guid) +void WorldSession::SendShowMailBox(ObjectGuid guid) { WorldPacket data(SMSG_SHOW_MAILBOX, 8); data << guid; @@ -113,26 +113,26 @@ void WorldSession::SendShowMailBox(uint64 guid) void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; recvData >> guid; SendTrainerList(guid); } -void WorldSession::SendTrainerList(uint64 guid) +void WorldSession::SendTrainerList(ObjectGuid guid) { std::string str = GetTrinityString(LANG_NPC_TAINER_HELLO); SendTrainerList(guid, str); } -void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) +void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle) { TC_LOG_DEBUG("network", "WORLD: SendTrainerList"); Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: SendTrainerList - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -140,19 +140,10 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - CreatureTemplate const* ci = unit->GetCreatureTemplate(); - - if (!ci) - { - TC_LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid)); - return; - } - TrainerSpellData const* trainer_spells = unit->GetTrainerSpells(); if (!trainer_spells) { - TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", - GUID_LOPART(guid), unit->GetEntry()); + TC_LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for %s", guid.ToString().c_str()); return; } @@ -241,16 +232,16 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 spellId = 0; recvData >> guid >> spellId; - TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId); + TC_LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL %s, learn spell id is: %u", guid.ToString().c_str(), spellId); Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -300,13 +291,13 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO"); - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -390,13 +381,13 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); - uint64 guid; + ObjectGuid guid; recvData >> guid; Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + TC_LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - %s not found or you can not interact with him.", guid.ToString().c_str()); return; } @@ -441,7 +432,7 @@ void WorldSession::SendSpiritResurrect() void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData) { - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive()) @@ -450,7 +441,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_INNKEEPER); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str()); return; } @@ -483,7 +474,7 @@ void WorldSession::SendBindPoint(Creature* npc) void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS"); - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; @@ -501,7 +492,7 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData) SendStablePet(npcGUID); } -void WorldSession::SendStablePet(uint64 guid) +void WorldSession::SendStablePet(ObjectGuid guid) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS_DETAIL); @@ -513,7 +504,7 @@ void WorldSession::SendStablePet(uint64 guid) _sendStabledPetCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); } -void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid) +void WorldSession::SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid) { if (!GetPlayer()) return; @@ -522,7 +513,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size - data << uint64 (guid); + data << uint64(guid); Pet* pet = _player->GetPet(); @@ -576,7 +567,7 @@ void WorldSession::SendStableResult(uint8 res) void WorldSession::HandleStablePet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET"); - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; @@ -651,7 +642,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result) void WorldSession::HandleUnstablePet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET."); - uint64 npcGUID; + ObjectGuid npcGUID; uint32 petnumber; recvData >> npcGUID >> petnumber; @@ -732,7 +723,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32 void WorldSession::HandleBuyStableSlot(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT."); - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; @@ -770,7 +761,7 @@ void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */) void WorldSession::HandleStableSwapPet(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET."); - uint64 npcGUID; + ObjectGuid npcGUID; uint32 petId; recvData >> npcGUID >> petId; @@ -863,7 +854,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) { TC_LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM"); - uint64 npcGUID, itemGUID; + ObjectGuid npcGUID, itemGUID; uint8 guildBank; // new in 2.3.2, bool that means from guild bank money recvData >> npcGUID >> itemGUID >> guildBank; @@ -871,7 +862,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR); if (!unit) { - TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + TC_LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - %s not found or you can not interact with him.", npcGUID.ToString().c_str()); return; } @@ -884,7 +875,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) if (itemGUID) { - TC_LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "ITEM: Repair %s, at %s", itemGUID.ToString().c_str(), npcGUID.ToString().c_str()); Item* item = _player->GetItemByGuid(itemGUID); if (item) @@ -892,7 +883,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) } else { - TC_LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID)); + TC_LOG_DEBUG("network", "ITEM: Repair all items at %s", npcGUID.ToString().c_str()); _player->DurabilityRepairAll(true, discountMod, guildBank != 0); } } |