aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorForesterDev <11771800+ForesterDev@users.noreply.github.com>2020-02-01 17:49:38 +0400
committerGitHub <noreply@github.com>2020-02-01 14:49:38 +0100
commitba1e5cd4134af429635068f323a2179c57a3c5eb (patch)
tree75c358ecde0c7a3904f53249763c222f8661254c /src/server/game/Entities
parenta9e534762f2517a37d595cdfef527ab55b6339ba (diff)
Core/PacketIO: convert some packets to to new packet class (#24100)
* Core/PacketIO: updated SMSG_INVALIDATE_PLAYER, SMSG_BINDER_CONFIRM, SMSG_BIND_POINT_UPDATE, SMSG_PLAYER_BOUND and SMSG_LOGIN_SET_TIME_SPEED * small corrections
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Player/Player.cpp53
-rw-r--r--src/server/game/Entities/Player/Player.h1
2 files changed, 37 insertions, 17 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index b9b7d734b9e..bd9137d5588 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -62,6 +62,7 @@
#include "LootMgr.h"
#include "Mail.h"
#include "MapManager.h"
+#include "MiscPackets.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -9440,9 +9441,8 @@ uint32 Player::GetXPRestBonus(uint32 xp)
void Player::SetBindPoint(ObjectGuid guid) const
{
- WorldPacket data(SMSG_BINDER_CONFIRM, 8);
- data << uint64(guid);
- SendDirectMessage(&data);
+ WorldPackets::Misc::BinderConfirm packet(guid);
+ SendDirectMessage(packet.Write());
}
void Player::SendTalentWipeConfirm(ObjectGuid guid) const
@@ -17085,6 +17085,15 @@ void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
CharacterDatabase.Execute(stmt);
}
+void Player::SendBindPointUpdate()
+{
+ WorldPackets::Misc::BindPointUpdate packet;
+ packet.BindPosition = Position(m_homebindX, m_homebindY, m_homebindZ);
+ packet.BindMapID = m_homebindMapId;
+ packet.BindAreaID = m_homebindAreaId;
+ SendDirectMessage(packet.Write());
+}
+
uint32 Player::GetUInt32ValueFromArray(Tokenizer const& data, uint16 index)
{
if (index >= data.size())
@@ -22592,52 +22601,62 @@ void Player::SetGroup(Group* group, int8 subgroup)
void Player::SendInitialPacketsBeforeAddToMap()
{
/// Pass 'this' as argument because we're not stored in ObjectAccessor yet
+ /// SMSG_CONTACT_LIST
GetSocial()->SendSocialList(this, SOCIAL_FLAG_ALL);
// guild bank list wtf?
- // Homebind
- WorldPacket data(SMSG_BINDPOINTUPDATE, 5*4);
- data << m_homebindX << m_homebindY << m_homebindZ;
- data << (uint32) m_homebindMapId;
- data << (uint32) m_homebindAreaId;
- SendDirectMessage(&data);
+ /// SMSG_BINDPOINTUPDATE
+ SendBindPointUpdate();
// SMSG_SET_PROFICIENCY
// SMSG_SET_PCT_SPELL_MODIFIER
// SMSG_SET_FLAT_SPELL_MODIFIER
// SMSG_UPDATE_AURA_DURATION
+ /// SMSG_TALENTS_INFO
SendTalentsInfoData(false);
- // SMSG_INSTANCE_DIFFICULTY
- data.Initialize(SMSG_INSTANCE_DIFFICULTY, 4+4);
+ /// SMSG_INSTANCE_DIFFICULTY
+ WorldPacket data(SMSG_INSTANCE_DIFFICULTY, 4+4);
data << uint32(GetMap()->GetDifficulty());
data << uint32(GetMap()->GetEntry()->IsDynamicDifficultyMap() && GetMap()->IsHeroic()); // Raid dynamic difficulty
SendDirectMessage(&data);
+ /// SMSG_INITIAL_SPELLS
SendInitialSpells();
+ /// SMSG_SEND_UNLEARN_SPELLS
SendUnlearnSpells();
+ /// SMSG_ACTION_BUTTONS
SendInitialActionButtons();
+
+ /// SMSG_INITIALIZE_FACTIONS
m_reputationMgr->SendInitialReputations();
+
+ /// SMSG_ALL_ACHIEVEMENT_DATA
m_achievementMgr->SendAllAchievementData();
+ /// SMSG_EQUIPMENT_SET_LIST
SendEquipmentSetList();
- data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
- data.AppendPackedTime(GameTime::GetGameTime());
- data << float(0.01666667f); // game speed
- data << uint32(0); // added in 3.1.2
- SendDirectMessage(&data);
+ /// SMSG_LOGIN_SET_TIME_SPEED
+ static float const TimeSpeed = 0.01666667f;
+ WorldPackets::Misc::LoginSetTimeSpeed loginSetTimeSpeed;
+ loginSetTimeSpeed.NewSpeed = TimeSpeed;
+ loginSetTimeSpeed.GameTime = GameTime::GetGameTime();
+ loginSetTimeSpeed.GameTimeHolidayOffset = 0; /// @todo
+ SendDirectMessage(loginSetTimeSpeed.Write());
- GetReputationMgr().SendForceReactions(); // SMSG_SET_FORCED_REACTIONS
+ /// SMSG_SET_FORCED_REACTIONS
+ GetReputationMgr().SendForceReactions();
// SMSG_TALENTS_INFO x 2 for pet (unspent points and talents in separate packets...)
// SMSG_PET_GUIDS
// SMSG_UPDATE_WORLD_STATE
// SMSG_POWER_UPDATE
+ /// SMSG_RESYNC_RUNES
ResyncRunes();
SetMovedUnit(this);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index f097d92373f..bcb0dfdc198 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1983,6 +1983,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void Recall() { TeleportTo(m_recall_location); }
void SetHomebind(WorldLocation const& loc, uint32 areaId);
+ void SendBindPointUpdate();
// Homebind coordinates
uint32 m_homebindMapId;