diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 0006292a3c..43fd0af340 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -58,6 +58,7 @@
#include "GuildMgr.h"
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
+#include "ItemPackets.h"
#include "KillRewarder.h"
#include "Language.h"
#include "LFGMgr.h"
@@ -21540,9 +21541,10 @@ void Player::SendSpellModifiers() const
// send Proficiency
void Player::SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) const
{
- WorldPacket data(SMSG_SET_PROFICIENCY, 1 + 4);
- data << uint8(itemClass) << uint32(itemSubclassMask);
- SendDirectMessage(&data);
+ WorldPackets::Item::SetProficiency packet;
+ packet.ProficiencyClass = itemClass;
+ packet.ProficiencyMask = itemSubclassMask;
+ SendDirectMessage(packet.Write());
}
void Player::RemovePetitionsAndSigns(ObjectGuid guid, uint32 type)
@@ -23334,50 +23336,12 @@ void Player::SetGroup(Group* group, int8 subgroup)
void Player::SendInitialPacketsBeforeAddToMap()
{
- /// Pass 'this' as argument because we're not stored in ObjectAccessor yet
- GetSocial()->SendSocialList(this, SOCIAL_FLAG_ALL);
+ /// SMSG_CONTROL_UPDATE
+ SetClientControl(this, true);
/// SMSG_BIND_POINT_UPDATE
SendBindPointUpdate();
- // SMSG_SET_PROFICIENCY
- // SMSG_SET_PCT_SPELL_MODIFIER
- // SMSG_SET_FLAT_SPELL_MODIFIER
-
- /// SMSG_TALENTS_INFO
- SendTalentsInfoData(false);
-
- /// SMSG_SEND_KNOWN_SPELLS
- SendKnownSpells();
-
- /// SMSG_SEND_UNLEARN_SPELLS
- SendDirectMessage(WorldPackets::Spells::SendUnlearnSpells().Write());
-
- /// SMSG_UPDATE_ACTION_BUTTONS
- SendInitialActionButtons();
-
- /// SMSG_INITIALIZE_FACTIONS
- m_reputationMgr->SendInitialReputations();
-
- /// SMSG_SET_FORCED_REACTIONS
- GetReputationMgr().SendForceReactions();
-
- /// SMSG_SETUP_CURRENCY
- SendCurrencies();
-
- /// SMSG_EQUIPMENT_SET_LIST
- SendEquipmentSetList();
-
- m_achievementMgr->SendAllAchievementData(this);
-
- /// 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());
-
/// SMSG_WORLD_SERVER_INFO
WorldPackets::Misc::WorldServerInfo worldServerInfo;
worldServerInfo.IsTournamentRealm = 0; /// @todo
@@ -23387,15 +23351,78 @@ void Player::SendInitialPacketsBeforeAddToMap()
worldServerInfo.WeeklyReset = sWorld->GetNextWeeklyQuestsResetTime() - WEEK;
SendDirectMessage(worldServerInfo.Write());
+ /// SMSG_SET_PROFICIENCY
+ SendProficiency(ITEM_CLASS_WEAPON, m_WeaponProficiency);
+ SendProficiency(ITEM_CLASS_ARMOR, m_ArmorProficiency);
+
+ /// SMSG_SEND_KNOWN_SPELLS
+ SendKnownSpells();
+
+ /// SMSG_SEND_UNLEARN_SPELLS
+ SendDirectMessage(WorldPackets::Spells::SendUnlearnSpells().Write());
+
+ /// SMSG_UPDATE_TALENT_DATA
+ SendTalentsInfoData(false);
+
+ /// SMSG_UPDATE_ACTION_BUTTONS
+ SendInitialActionButtons();
+
+ /// SMSG_INITIALIZE_FACTIONS
+ m_reputationMgr->SendInitialReputations();
+
+ /// MSG_SET_DUNGEON_DIFFICULTY
+ // Handled in WorldSession::HandlePlayerLogin
+
+ /// SMSG_ACCOUNT_DATA_TIMES
+ // Handled in WorldSession::HandlePlayerLogin
+
+ /// Pass 'this' as argument because we're not stored in ObjectAccessor yet
+ GetSocial()->SendSocialList(this, SOCIAL_FLAG_ALL);
+
+ /// SMSG_MOTD
+ // Handled in WorldSession::HandlePlayerLogin
+
+ /// SMSG_FEATURE_SYSTEM_STATUS
+ // Handled in WorldSession::HandlePlayerLogin
+
+ /// SMSG_RESYNC_RUNES
+ if (getClass() == CLASS_DEATH_KNIGHT)
+ ResyncRunes(0);
+
// Spell modifiers
SendSpellModifiers();
+ /// SMSG_SET_FORCED_REACTIONS
+ GetReputationMgr().SendForceReactions();
+
+ /// SMSG_SETUP_CURRENCY
+ SendCurrencies();
+
+ /// SMSG_WEEKLY_SPELL_USAGE
+
+ /// SMSG_ALL_ACHIEVEMENT_DATA
+ m_achievementMgr->SendAllAchievementData(this);
+
+ /// SMSG_LOGIN_SET_TIME_SPEED
+ static float const TimeSpeed = 0.016666667535901069f;
+ WorldPackets::Misc::LoginSetTimeSpeed loginSetTimeSpeed;
+ loginSetTimeSpeed.NewSpeed = TimeSpeed;
+ loginSetTimeSpeed.GameTime = GameTime::GetGameTime();
+ loginSetTimeSpeed.GameTimeHolidayOffset = 0; /// @todo
+ SendDirectMessage(loginSetTimeSpeed.Write());
+
+ /// SMSG_EQUIPMENT_SET_LIST
+ SendEquipmentSetList();
+
// SMSG_TALENTS_INFO x 2 for pet (unspent points and talents in separate packets...)
// SMSG_PET_GUIDS
// SMSG_UPDATE_WORLD_STATE
// SMSG_POWER_UPDATE
- SetMover(this);
+ // Not going with SetMover(this); because sniffs show no packet
+ m_unitMovedByMe->m_playerMovingMe = nullptr;
+ m_unitMovedByMe = this;
+ m_unitMovedByMe->m_playerMovingMe = this;
}
void Player::SendInitialPacketsAfterAddToMap()
@@ -23405,7 +23432,7 @@ void Player::SendInitialPacketsAfterAddToMap()
// update zone
uint32 newzone, newarea;
GetZoneAndAreaId(newzone, newarea);
- UpdateZone(newzone, newarea); // also call SendInitWorldStates();
+ UpdateZone(newzone, newarea); // also calls SendInitWorldStates and SendZoneDynamicInfo
GetSession()->ResetTimeSync();
GetSession()->SendTimeSync();
@@ -23446,17 +23473,6 @@ void Player::SendInitialPacketsAfterAddToMap()
SendQuestGiverStatusMultiple();
SendTaxiNodeStatusMultiple();
- if (getClass() == CLASS_DEATH_KNIGHT)
- {
- for (uint8 i = 0; i < MAX_RUNES; i++)
- {
- WorldPackets::Spells::ConvertRune packet;
- packet.Index = i;
- packet.Rune = GetCurrentRune(i);
- SendDirectMessage(packet.Write());
- }
- }
-
// raid downscaling - send difficulty to player
if (GetMap()->IsRaid())
{
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 8f9ca9a90e..1fdb7ae5db 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -823,41 +823,10 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
pCurrChar->GetMotionMaster()->Initialize();
pCurrChar->SendDungeonDifficulty(false);
- WorldPackets::Character::LoginVerifyWorld loginVerifyWorld;
- loginVerifyWorld.MapID = pCurrChar->GetMapId();
- loginVerifyWorld.Pos = pCurrChar->GetPosition();
- SendPacket(loginVerifyWorld.Write());
-
// load player specific part before send times
LoadAccountData(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA), PER_CHARACTER_CACHE_MASK);
SendAccountDataTimes(PER_CHARACTER_CACHE_MASK);
- WorldPackets::System::FeatureSystemStatus features;
- features.ComplaintStatus = 2;
- features.ScrollOfResurrectionRequestsRemaining = 1;
- features.ScrollOfResurrectionMaxRequestsPerDay = 1;
- features.CfgRealmID = realm.Id.Realm;
- features.CfgRealmRecID = 0;
-
- bool europaTicketSystemEnabled = sWorld->getBoolConfig(CONFIG_ALLOW_BUG_REPORTS_AND_SUGGESTIONS);
- if (europaTicketSystemEnabled)
- {
- features.EuropaTicketSystemStatus = boost::in_place();
- features.EuropaTicketSystemStatus->TryCount = 1;
- features.EuropaTicketSystemStatus->LastResetTimeBeforeNow = 264134872; // Pulled from sniff data
- features.EuropaTicketSystemStatus->PerMilliseconds = 10;
- features.EuropaTicketSystemStatus->MaxTries = 60;
- }
-
- SendPacket(features.Write());
-
- // Send MOTD
- {
- WorldPackets::System::MOTD motd;
- motd.Text = &sWorld->GetMotd();
- SendPacket(motd.Write());
- }
-
// send server info
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
chH.PSendSysMessage(GitRevision::GetFullVersion());
@@ -895,6 +864,32 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
pCurrChar->SendInitialPacketsBeforeAddToMap();
+ // Send MOTD
+ {
+ WorldPackets::System::MOTD motd;
+ motd.Text = &sWorld->GetMotd();
+ SendPacket(motd.Write());
+ }
+
+ WorldPackets::System::FeatureSystemStatus features;
+ features.ComplaintStatus = 2;
+ features.ScrollOfResurrectionRequestsRemaining = 1;
+ features.ScrollOfResurrectionMaxRequestsPerDay = 1;
+ features.CfgRealmID = realm.Id.Realm;
+ features.CfgRealmRecID = 0;
+
+ bool europaTicketSystemEnabled = sWorld->getBoolConfig(CONFIG_ALLOW_BUG_REPORTS_AND_SUGGESTIONS);
+ if (europaTicketSystemEnabled)
+ {
+ features.EuropaTicketSystemStatus = boost::in_place();
+ features.EuropaTicketSystemStatus->TryCount = 1;
+ features.EuropaTicketSystemStatus->LastResetTimeBeforeNow = 264134872; // Pulled from sniff data
+ features.EuropaTicketSystemStatus->PerMilliseconds = 10;
+ features.EuropaTicketSystemStatus->MaxTries = 60;
+ }
+
+ SendPacket(features.Write());
+
//Show cinematic at the first time that player login
if (!pCurrChar->getCinematic())
{
@@ -937,6 +932,11 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
}
}
+ WorldPackets::Character::LoginVerifyWorld loginVerifyWorld;
+ loginVerifyWorld.MapID = pCurrChar->GetMapId();
+ loginVerifyWorld.Pos = pCurrChar->GetPosition();
+ SendPacket(loginVerifyWorld.Write());
+
// check if player is on transport and not added earlier to transport
// e.g. in case of loading transport on grid load
if (pCurrChar->GetTransportSpawnID() && !pCurrChar->GetTransport())
diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h
index d443be42a3..bb093333a4 100644
--- a/src/server/game/Server/Packets/AllPackets.h
+++ b/src/server/game/Server/Packets/AllPackets.h
@@ -24,6 +24,7 @@
#include "CombatLogPackets.h"
#include "CombatPackets.h"
#include "GuildPackets.h"
+#include "ItemPackets.h"
#include "LFGPackets.h"
#include "MiscPackets.h"
#include "MovementPackets.h"
diff --git a/src/server/game/Server/Packets/ItemPackets.cpp b/src/server/game/Server/Packets/ItemPackets.cpp
new file mode 100644
index 0000000000..a39088fbd9
--- /dev/null
+++ b/src/server/game/Server/Packets/ItemPackets.cpp
@@ -0,0 +1,26 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * 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 "ItemPackets.h"
+
+WorldPacket const* WorldPackets::Item::SetProficiency::Write()
+{
+ _worldPacket << uint8(ProficiencyClass);
+ _worldPacket << uint32(ProficiencyMask);
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/ItemPackets.h b/src/server/game/Server/Packets/ItemPackets.h
new file mode 100644
index 0000000000..b046d0f303
--- /dev/null
+++ b/src/server/game/Server/Packets/ItemPackets.h
@@ -0,0 +1,40 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * 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 ItemPackets_h__
+#define ItemPackets_h__
+
+#include "Packet.h"
+
+namespace WorldPackets
+{
+ namespace Item
+ {
+ class SetProficiency final : public ServerPacket
+ {
+ public:
+ SetProficiency() : ServerPacket(SMSG_SET_PROFICIENCY, 4 + 1) { }
+
+ WorldPacket const* Write() override;
+
+ uint32 ProficiencyMask = 0;
+ uint8 ProficiencyClass = 0;
+ };
+ }
+}
+
+#endif // ItemPackets_h_
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index f5a0c19bde..d6167c3f8c 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1806,20 +1806,23 @@ void Spell::EffectProficiency(SpellEffIndex /*effIndex*/)
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
- if (m_caster->GetTypeId() != TYPEID_PLAYER)
+ if (!m_caster->IsPlayer())
return;
- Player* p_target = m_caster->ToPlayer();
+
+ Player* player = m_caster->ToPlayer();
uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask;
- if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask))
+ if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(player->GetWeaponProficiency() & subClassMask))
{
- p_target->AddWeaponProficiency(subClassMask);
- p_target->SendProficiency(ITEM_CLASS_WEAPON, p_target->GetWeaponProficiency());
+ player->AddWeaponProficiency(subClassMask);
+ if (!player->IsLoading())
+ player->SendProficiency(ITEM_CLASS_WEAPON, player->GetWeaponProficiency());
}
- if (m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask))
+ if (m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(player->GetArmorProficiency() & subClassMask))
{
- p_target->AddArmorProficiency(subClassMask);
- p_target->SendProficiency(ITEM_CLASS_ARMOR, p_target->GetArmorProficiency());
+ player->AddArmorProficiency(subClassMask);
+ if (!player->IsLoading())
+ player->SendProficiency(ITEM_CLASS_ARMOR, player->GetArmorProficiency());
}
}