Core/Creatures: backported trainer update and skill initialization

This commit is contained in:
Ovahlord committed 2020-01-12 23:53:35 +01:00
1 parent 0e60ed1682
commit 7760d95962
34 files changed
+1390 -869

No files matched your search

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "NPCPackets.h"
void WorldPackets::NPC::Hello::Read()
{
_worldPacket >> Unit;
}
WorldPacket const* WorldPackets::NPC::TrainerList::Write()
{
_worldPacket << TrainerGUID;
_worldPacket << uint32(TrainerType);
_worldPacket << uint32(TrainerID);
_worldPacket << uint32(Spells.size());
for (TrainerListSpell const& spell : Spells)
{
_worldPacket << uint32(spell.SpellID);
_worldPacket << uint8(spell.Usable);
_worldPacket << uint32(spell.MoneyCost);
_worldPacket << uint8(spell.ReqLevel);
_worldPacket << uint32(spell.ReqSkillLine);
_worldPacket << uint32(spell.ReqSkillRank);
_worldPacket.append(spell.ReqAbility.data(), spell.ReqAbility.size());
_worldPacket << uint32(spell.ProfessionDialog);
_worldPacket << uint32(spell.ProfessionButton);
}
_worldPacket << Greeting;
return &_worldPacket;
}
void WorldPackets::NPC::TrainerBuySpell::Read()
{
_worldPacket >> TrainerGUID;
_worldPacket >> TrainerID;
_worldPacket >> SpellID;
}
WorldPacket const* WorldPackets::NPC::TrainerBuyFailed::Write()
{
_worldPacket << TrainerGUID;
_worldPacket << int32(SpellID);
_worldPacket << int32(TrainerFailedReason);
return &_worldPacket;
}
WorldPacket const* WorldPackets::NPC::TrainerBuySucceeded::Write()
{
_worldPacket << TrainerGUID;
_worldPacket << int32(SpellID);
return &_worldPacket;
}