Compare commits
10 Commits
d1fcca82a0
...
0a3d6d8c4f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a3d6d8c4f | ||
|
|
2596661866 | ||
|
|
732474219c | ||
|
|
874a124588 | ||
|
|
5de2bb0a11 | ||
|
|
9ce4b511a5 | ||
|
|
f0d81a0cca | ||
|
|
4d8c43de29 | ||
|
|
004672ce4b | ||
|
|
3768f198be |
@ -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;
|
||||
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user