Compare commits

...

10 Commits

Author SHA1 Message Date
manstfu
0a3d6d8c4f
Merge 2596661866af78f8a58eac0dfcd77667d0cdc1e5 into 58d13e69e146abc41ee3183234f9cfc9a920d216 2025-02-18 11:06:11 +02:00
manstfu
2596661866
Update NPCHandler.cpp 2025-02-15 13:36:38 +01:00
manstfu
732474219c
Update NPCHandler.cpp 2025-02-15 13:14:52 +01:00
manstfu
874a124588
Update NPCHandler.cpp 2025-02-15 13:02:28 +01:00
manstfu
5de2bb0a11
Merge branch 'master' into multitrainer-method 2025-02-09 12:56:04 +01:00
manstfu
9ce4b511a5
Update NPCHandler.cpp 2025-02-07 21:12:47 +01:00
manstfu
f0d81a0cca
Update NPCHandler.cpp 2025-02-07 20:25:21 +01:00
manstfu
4d8c43de29
Update NPCHandler.cpp 2025-02-07 20:04:51 +01:00
manstfu
004672ce4b
Update WorldSession.cpp 2025-02-07 19:46:24 +01:00
manstfu
3768f198be
Update WorldSession.h 2025-02-07 19:45:12 +01:00
3 changed files with 15 additions and 9 deletions

View File

@ -84,17 +84,17 @@ void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
SendTrainerList(guid);
}
void WorldSession::SendTrainerList(ObjectGuid guid)
void WorldSession::SendTrainerList(ObjectGuid guid, uint32 trainerEntry)
{
std::string str = GetAcoreString(LANG_NPC_TAINER_HELLO);
SendTrainerList(guid, str);
SendTrainerList(guid, str, trainerEntry);
}
void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle, uint32 trainerEntry)
{
LOG_DEBUG("network", "WORLD: SendTrainerList");
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
Creature* unit = trainerEntry ? GetPlayer()->GetMap()->GetCreature(guid) : GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
LOG_DEBUG("network", "WORLD: SendTrainerList - Unit ({}) not found or you can not interact with him.", guid.ToString());
@ -113,7 +113,8 @@ void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
return;
}
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
SetCurrentTrainer(trainerEntry);
TrainerSpellData const* trainer_spells = GetCurrentTrainer() ? sObjectMgr->GetNpcTrainerSpells(GetCurrentTrainer()) : unit->GetTrainerSpells();
if (!trainer_spells)
{
LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature ({})", guid.ToString());
@ -216,7 +217,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
recvData >> guid >> spellId;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
Creature* unit = GetCurrentTrainer() ? sObjectMgr->GetNpcTrainerSpells(GetCurrentTrainer()) : GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
{
LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit ({}) not found or you can not interact with him.", guid.ToString());
@ -228,7 +229,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// check present spell in trainer spell list
TrainerSpellData const* trainer_spells = unit->GetTrainerSpells();
TrainerSpellData const* trainer_spells = GetCurrentTrainer() ? sObjectMgr->GetNpcTrainerSpells(GetCurrentTrainer()) : unit->GetTrainerSpells();
if (!trainer_spells)
return;

View File

@ -130,6 +130,7 @@ WorldSession::WorldSession(uint32 id, std::string&& name, std::shared_ptr<WorldS
recruiterId(recruiter),
isRecruiter(isARecruiter),
m_currentVendorEntry(0),
m_currentTrainerEntry(0),
_calendarEventCreationCooldown(0),
_addonMessageReceiveCount(0),
_timeSyncClockDeltaQueue(6),

View File

@ -380,6 +380,9 @@ public:
uint32 GetCurrentVendor() const { return m_currentVendorEntry; }
void SetCurrentVendor(uint32 vendorEntry) { m_currentVendorEntry = vendorEntry; }
[[nodiscard]] uint32 GetCurrentTrainer() const { return m_currentTrainerEntry; }
void SetCurrentTrainer(uint32 trainerEntry) { m_currentTrainerEntry = trainerEntry; }
ObjectGuid::LowType GetGuidLow() const;
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
@ -430,8 +433,8 @@ public:
//void SendTestCreatureQueryOpcode(uint32 entry, ObjectGuid guid, uint32 testvalue);
void SendNameQueryOpcode(ObjectGuid guid);
void SendTrainerList(ObjectGuid guid);
void SendTrainerList(ObjectGuid guid, std::string const& strTitle);
void SendTrainerList(ObjectGuid guid, uint32 trainerEntry = 0);
void SendTrainerList(ObjectGuid guid, std::string const& strTitle, uint32 trainerEntry = 0);
void SendListInventory(ObjectGuid guid, uint32 vendorEntry = 0);
void SendShowBank(ObjectGuid guid);
bool CanOpenMailBox(ObjectGuid guid);
@ -1184,6 +1187,7 @@ private:
bool isRecruiter;
LockedQueue<WorldPacket*> _recvQueue;
uint32 m_currentVendorEntry;
uint32 m_currentTrainerEntry;
ObjectGuid m_currentBankerGUID;
uint32 _offlineTime;
bool _kicked;