diff options
Diffstat (limited to 'src/server/game/Handlers/NPCHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/NPCHandler.cpp | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 02651a1af09..6e4ae69c7b9 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -51,13 +51,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; } @@ -68,7 +68,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; @@ -77,7 +77,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid) void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; TC_LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE"); @@ -86,7 +86,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; } @@ -97,7 +97,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; @@ -105,28 +105,35 @@ void WorldSession::SendShowBank(uint64 guid) SendPacket(&data); } +void WorldSession::SendShowMailBox(ObjectGuid guid) +{ + WorldPacket data(SMSG_SHOW_MAILBOX, 8); + data << guid; + SendPacket(&data); +} + 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; } @@ -134,19 +141,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; } @@ -237,17 +235,17 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) { - uint64 guid; + ObjectGuid guid; uint32 spellId; uint32 trainerId; recvData >> guid >> trainerId >> 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; } @@ -318,13 +316,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; } @@ -406,13 +404,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; } @@ -457,7 +455,7 @@ void WorldSession::SendSpiritResurrect() void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData) { - uint64 npcGUID; + ObjectGuid npcGUID; recvData >> npcGUID; if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive()) @@ -466,7 +464,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; } @@ -499,7 +497,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; @@ -517,7 +515,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); @@ -529,7 +527,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; @@ -538,7 +536,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(); @@ -594,7 +592,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; @@ -668,7 +666,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; @@ -749,7 +747,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; @@ -787,7 +785,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; @@ -882,7 +880,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; @@ -890,7 +888,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; } @@ -903,7 +901,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) @@ -911,7 +909,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); } } |