From da52c8d54ec341cc55f963fe0397fcc5e98b06e9 Mon Sep 17 00:00:00 2001 From: Intel Date: Wed, 12 Nov 2014 03:58:17 +0200 Subject: Core/Talents: Fixed SMSG_TALENTS_INFO packet Fixed talents saving to DB Renamed 'talent spec' to 'talent group' since this name was shadowing character specializations (and new name is correct according to JAM) Enabled loading of MinorTalent.dbc (will be used later) Added additional specialization check in LearnTalent --- src/server/game/Server/Packets/TalentPackets.cpp | 38 +++++++++++++++++ src/server/game/Server/Packets/TalentPackets.h | 54 ++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 src/server/game/Server/Packets/TalentPackets.cpp create mode 100644 src/server/game/Server/Packets/TalentPackets.h (limited to 'src/server/game/Server') diff --git a/src/server/game/Server/Packets/TalentPackets.cpp b/src/server/game/Server/Packets/TalentPackets.cpp new file mode 100644 index 00000000000..3410fb273f7 --- /dev/null +++ b/src/server/game/Server/Packets/TalentPackets.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008-2014 TrinityCore + * + * 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 . + */ + +#include "TalentPackets.h" + +WorldPacket const* WorldPackets::Talent::UpdateTalentData::Write() +{ + _worldPacket << Info.ActiveGroup; + _worldPacket << uint32(Info.TalentGroups.size()); + + for (auto& talentGroupInfo : Info.TalentGroups) + { + _worldPacket << talentGroupInfo.SpecID; + _worldPacket << uint32(talentGroupInfo.TalentIDs.size()); + + for (uint32 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i) + _worldPacket << talentGroupInfo.GlyphIDs[i]; + + for (uint16 talentID : talentGroupInfo.TalentIDs) + _worldPacket << talentID; + } + + return &_worldPacket; +} diff --git a/src/server/game/Server/Packets/TalentPackets.h b/src/server/game/Server/Packets/TalentPackets.h new file mode 100644 index 00000000000..c756c6962bb --- /dev/null +++ b/src/server/game/Server/Packets/TalentPackets.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2008-2014 TrinityCore + * + * 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 . + */ + +#ifndef TalentPackets_h__ +#define TalentPackets_h__ + +#include "Packet.h" +#include "Player.h" +#include + +namespace WorldPackets +{ + namespace Talent + { + struct TalentGroupInfo + { + uint32 SpecID; + std::vector TalentIDs; + uint16 GlyphIDs[MAX_GLYPH_SLOT_INDEX]; + }; + + struct TalentInfoUpdate + { + uint8 ActiveGroup; + std::vector TalentGroups; + }; + + class UpdateTalentData final : public ServerPacket + { + public: + UpdateTalentData() : ServerPacket(SMSG_TALENTS_INFO, 2+4+4+4+12) { } + + WorldPacket const* Write() override; + + TalentInfoUpdate Info; + }; + } +} + +#endif // TalentPackets_h__ -- cgit v1.2.3