summaryrefslogtreecommitdiff
path: root/src/server/game/Handlers
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers')
-rw-r--r--src/server/game/Handlers/AddonHandler.cpp10
-rw-r--r--src/server/game/Handlers/AddonHandler.h10
-rw-r--r--src/server/game/Handlers/ArenaTeamHandler.cpp12
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp10
-rw-r--r--src/server/game/Handlers/AuthHandler.cpp10
-rw-r--r--src/server/game/Handlers/BankHandler.cpp10
-rw-r--r--src/server/game/Handlers/BattleGroundHandler.cpp22
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp46
-rw-r--r--src/server/game/Handlers/ChannelHandler.cpp10
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp91
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp56
-rw-r--r--src/server/game/Handlers/CombatHandler.cpp10
-rw-r--r--src/server/game/Handlers/DuelHandler.cpp10
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp16
-rw-r--r--src/server/game/Handlers/GuildHandler.cpp10
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp14
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp10
-rw-r--r--src/server/game/Handlers/LootHandler.cpp12
-rw-r--r--src/server/game/Handlers/MailHandler.cpp10
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp105
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp545
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp10
-rw-r--r--src/server/game/Handlers/NPCHandler.h10
-rw-r--r--src/server/game/Handlers/PetHandler.cpp33
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp18
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp10
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp12
-rw-r--r--src/server/game/Handlers/ReferAFriendHandler.cpp12
-rw-r--r--src/server/game/Handlers/SkillHandler.cpp10
-rw-r--r--src/server/game/Handlers/Socialhandler.cpp10
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp10
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp92
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp10
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp12
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp15
-rw-r--r--src/server/game/Handlers/VoiceChatHandler.cpp10
36 files changed, 637 insertions, 666 deletions
diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp
index fd8954907d..2ac47870c5 100644
--- a/src/server/game/Handlers/AddonHandler.cpp
+++ b/src/server/game/Handlers/AddonHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/AddonHandler.h b/src/server/game/Handlers/AddonHandler.h
index 3382b3e031..c8cd5f7c7b 100644
--- a/src/server/game/Handlers/AddonHandler.h
+++ b/src/server/game/Handlers/AddonHandler.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp
index e982f61fc4..65ad0e0c70 100644
--- a/src/server/game/Handlers/ArenaTeamHandler.cpp
+++ b/src/server/game/Handlers/ArenaTeamHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -160,7 +160,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData)
WorldPacket data(SMSG_ARENA_TEAM_INVITE, (8 + 10));
data << GetPlayer()->GetName();
data << arenaTeam->GetName();
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_INVITE");
}
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index a3205df4b3..50df6f4d34 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp
index 45a87579b9..52dcffdecd 100644
--- a/src/server/game/Handlers/AuthHandler.cpp
+++ b/src/server/game/Handlers/AuthHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/BankHandler.cpp b/src/server/game/Handlers/BankHandler.cpp
index 85e1bd8780..3138727194 100644
--- a/src/server/game/Handlers/BankHandler.cpp
+++ b/src/server/game/Handlers/BankHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index c66ea7361d..dba88af1b7 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -265,7 +265,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
{
WorldPacket data;
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
- member->GetSession()->SendPacket(&data);
+ member->SendDirectMessage(&data);
});
return;
@@ -283,10 +283,10 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
// send status packet
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, member->AddBattlegroundQueueId(bgQueueTypeId), STATUS_WAIT_QUEUE, avgWaitTime, 0, 0, TEAM_NEUTRAL);
- member->GetSession()->SendPacket(&data);
+ member->SendDirectMessage(&data);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
- member->GetSession()->SendPacket(&data);
+ member->SendDirectMessage(&data);
sScriptMgr->OnPlayerJoinBG(member);
});
@@ -879,7 +879,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
if (err <= 0)
{
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
- member->GetSession()->SendPacket(&data);
+ member->SendDirectMessage(&data);
continue;
}
@@ -887,10 +887,10 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
// send status packet
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, queueSlot, STATUS_WAIT_QUEUE, avgWaitTime, 0, arenatype, TEAM_NEUTRAL, isRated);
- member->GetSession()->SendPacket(&data);
+ member->SendDirectMessage(&data);
sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err);
- member->GetSession()->SendPacket(&data);
+ member->SendDirectMessage(&data);
LOG_DEBUG("bg.battleground", "Battleground: player joined queue for arena as group bg queue type {} bg type {}: {}, NAME {}", bgQueueTypeId, bgTypeId, member->GetGUID().ToString(), member->GetName());
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 53cccbf4e0..d5b41e41c1 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -35,6 +35,7 @@ Copied events should probably have a new owner
#include "ArenaTeamMgr.h"
#include "CalendarMgr.h"
+#include "CalendarPackets.h"
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
@@ -184,43 +185,31 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
SendPacket(&data);
}
-void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
+void WorldSession::HandleCalendarGetEvent(WorldPackets::Calendar::GetEvent& packet)
{
- uint64 eventId;
- recvData >> eventId;
+ LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [{}] Event [{}]", _player->GetGUID().ToString(), packet.EventId);
- LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [{}] Event [{}]", _player->GetGUID().ToString(), eventId);
-
- if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
+ if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(packet.EventId))
sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET);
else
sCalendarMgr->SendCalendarCommandResult(_player->GetGUID(), CALENDAR_ERROR_EVENT_INVALID);
}
-void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
+void WorldSession::HandleCalendarGuildFilter(WorldPackets::Calendar::GuildFilter& packet)
{
LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [{}]", _player->GetGUID().ToString());
- uint32 minLevel;
- uint32 maxLevel;
- uint32 minRank;
-
- recvData >> minLevel >> maxLevel >> minRank;
-
if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId()))
- guild->MassInviteToEvent(this, minLevel, maxLevel, minRank);
+ guild->MassInviteToEvent(this, packet.MinimumLevel, packet.MaximumLevel, packet.MinimumRank);
- LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [{}], Max level [{}], Min rank [{}]", minLevel, maxLevel, minRank);
+ LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [{}], Max level [{}], Min rank [{}]", packet.MinimumLevel, packet.MaximumLevel, packet.MinimumRank);
}
-void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
+void WorldSession::HandleCalendarArenaTeam(WorldPackets::Calendar::ArenaTeam& packet)
{
LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [{}]", _player->GetGUID().ToString());
- uint32 arenaTeamId;
- recvData >> arenaTeamId;
-
- if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(arenaTeamId))
+ if (ArenaTeam* team = sArenaTeamMgr->GetArenaTeamById(packet.ArenaTeamId))
team->MassInviteToEvent(this);
}
@@ -763,14 +752,11 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_INVALID);
}
-void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
+void WorldSession::HandleCalendarComplain(WorldPackets::Calendar::CalendarComplain& packet)
{
ObjectGuid guid = _player->GetGUID();
- uint64 eventId;
- ObjectGuid complainGUID;
- recvData >> eventId >> complainGUID;
- LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [{}] EventId [{}] guid [{}]", guid.ToString(), eventId, complainGUID.ToString());
+ LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [{}] EventId [{}] guid [{}]", guid.ToString(), packet.EventId, packet.ComplainGuid.ToString());
// what to do with complains?
}
diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp
index 37c7a34c71..2193daaabe 100644
--- a/src/server/game/Handlers/ChannelHandler.cpp
+++ b/src/server/game/Handlers/ChannelHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 2169cb5316..eeff0d3d64 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -668,51 +668,46 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
{
- m_playerLoading = true;
- ObjectGuid playerGuid;
- recvData >> playerGuid;
+ if (!sWorld->getBoolConfig(CONFIG_REALM_LOGIN_ENABLED))
+ {
+ SendCharLoginFailed(LoginFailureReason::NoWorld);
+ return;
+ }
- if (PlayerLoading() || GetPlayer() != nullptr || !playerGuid.IsPlayer())
+ if (PlayerLoading() || GetPlayer() != nullptr)
{
- // limit player interaction with the world
- if (!sWorld->getBoolConfig(CONFIG_REALM_LOGIN_ENABLED))
- {
- WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1);
- // see LoginFailureReason enum for more reasons
- data << uint8(LoginFailureReason::NoWorld);
- SendPacket(&data);
- return;
- }
+ LOG_ERROR("network", "Player tried to login again, AccountId = {}", GetAccountId());
+ KickPlayer("WorldSession::HandlePlayerLoginOpcode Another client logging in");
+ return;
}
- if (!playerGuid.IsPlayer() || !IsLegitCharacterForAccount(playerGuid))
+ ObjectGuid playerGuid;
+ recvData >> playerGuid;
+
+ if (!IsLegitCharacterForAccount(playerGuid))
{
LOG_ERROR("network", "Account ({}) can't login with that character ({}).", GetAccountId(), playerGuid.ToString());
KickPlayer("Account can't login with this character");
return;
}
- auto SendCharLogin = [&](ResponseCodes result)
- {
- WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1);
- data << uint8(result);
- SendPacket(&data);
- };
-
// pussywizard:
if (WorldSession* sess = sWorldSessionMgr->FindOfflineSessionForCharacterGUID(playerGuid.GetCounter()))
+ {
if (sess->GetAccountId() != GetAccountId())
{
- SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER);
+ SendCharLoginFailed(LoginFailureReason::DuplicateCharacter);
return;
}
+ }
+
// pussywizard:
if (WorldSession* sess = sWorldSessionMgr->FindOfflineSession(GetAccountId()))
{
Player* p = sess->GetPlayer();
if (!p || sess->IsKicked())
{
- SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER);
+ SendCharLoginFailed(LoginFailureReason::DuplicateCharacter);
return;
}
@@ -723,7 +718,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
// pussywizard: players stay ingame no matter what (prevent abuse), but allow to turn it off to stop crashing
if (!sWorld->getBoolConfig(CONFIG_ENABLE_LOGIN_AFTER_DC))
{
- SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER);
+ SendCharLoginFailed(LoginFailureReason::DuplicateCharacter);
return;
}
@@ -765,7 +760,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
}
if (!p->FindMap() || !p->IsInWorld() || sess->IsKicked())
{
- SendCharLogin(CHAR_LOGIN_DUPLICATE_CHARACTER);
+ SendCharLoginFailed(LoginFailureReason::DuplicateCharacter);
return;
}
@@ -781,11 +776,9 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
std::shared_ptr<LoginQueryHolder> holder = std::make_shared<LoginQueryHolder>(GetAccountId(), playerGuid);
if (!holder->Initialize())
- {
- m_playerLoading = false;
return;
- }
+ m_playerLoading = true;
AddQueryHolderCallback(CharacterDatabase.DelayQueryHolder(holder)).AfterComplete([this](SQLQueryHolderBase const& holder)
{
HandlePlayerLoginFromDB(static_cast<LoginQueryHolder const&>(holder));
@@ -957,7 +950,6 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
pCurrChar->CastSpell(pCurrChar, 20584, true, 0); // auras SPELL_AURA_INCREASE_SPEED(+speed in wisp form), SPELL_AURA_INCREASE_SWIM_SPEED(+swim speed in wisp form), SPELL_AURA_TRANSFORM (to wisp form)
pCurrChar->CastSpell(pCurrChar, 8326, true, 0); // auras SPELL_AURA_GHOST, SPELL_AURA_INCREASE_SPEED(why?), SPELL_AURA_INCREASE_SWIM_SPEED(why?)
- pCurrChar->SetMovement(MOVE_WATER_WALK);
}
// Set FFA PvP for non GM in non-rest mode
@@ -1171,15 +1163,23 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
SendPacket(&data);
// Xinef: fix possible problem with flag UNIT_FLAG_STUNNED added during logout
- if (!pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
+ if (pCurrChar->HasUnitState(UNIT_STATE_LOGOUT_TIMER))
+ {
+ pCurrChar->SetRooted(false, true, true);
pCurrChar->RemoveUnitFlag(UNIT_FLAG_STUNNED);
+ }
+
+ if (pCurrChar->GetPendingFlightChange() <= pCurrChar->GetMapChangeOrderCounter())
+ {
+ if (!pCurrChar->HasIncreaseMountedFlightSpeedAura() && !pCurrChar->HasFlyAura())
+ pCurrChar->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_CAN_FLY);
+ }
pCurrChar->SendInitialPacketsBeforeAddToMap();
// necessary actions from AddPlayerToMap:
pCurrChar->GetMap()->SendInitTransports(pCurrChar);
pCurrChar->GetMap()->SendInitSelf(pCurrChar);
- pCurrChar->GetMap()->SendZoneDynamicInfo(pCurrChar);
// If we are logging into an existing player, simply clear visibility references
// so player will receive a fresh list of new objects on the next vis update.
@@ -1762,9 +1762,21 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
std::string name;
recvData >> name;
+ if (name.length() > 16) // Client limitation
+ {
+ LOG_ERROR("entities.player.cheat", "Character GUID {} tried to create equipment set {} with too long a name!", _player->GetGUID().ToString(), setGuid);
+ return;
+ }
+
std::string iconName;
recvData >> iconName;
+ if (iconName.length() > 100) // DB limitation
+ {
+ LOG_ERROR("entities.player.cheat", "Character GUID {} tried to create equipment set {} with too long an icon name!", _player->GetGUID().ToString(), setGuid);
+ return;
+ }
+
EquipmentSet eqSet;
eqSet.Guid = setGuid;
@@ -2576,6 +2588,13 @@ void WorldSession::SendCharDelete(ResponseCodes result)
SendPacket(&data);
}
+void WorldSession::SendCharLoginFailed(LoginFailureReason reason)
+{
+ WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1);
+ data << uint8(reason);
+ SendPacket(&data);
+};
+
void WorldSession::SendCharRename(ResponseCodes result, CharacterRenameInfo const* renameInfo)
{
WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + renameInfo->Name.size() + 1);
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index 04337cd9c8..f191dc05ae 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -434,11 +434,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
return;
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
WorldPacket data;
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), sender, nullptr, msg);
@@ -452,11 +448,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
{
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, guild))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
guild->BroadcastToGuild(this, false, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
}
@@ -470,11 +462,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
{
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, guild))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
guild->BroadcastToGuild(this, true, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
}
@@ -493,11 +481,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, Language(lang), sender, nullptr, msg);
@@ -516,11 +500,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, Language(lang), sender, nullptr, msg);
@@ -534,11 +514,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
return;
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
// In battleground, raid warning is sent only to players in battleground - code is ok
WorldPacket data;
@@ -554,11 +530,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
return;
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND, Language(lang), sender, nullptr, msg);
@@ -573,11 +545,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
return;
if (!sScriptMgr->OnPlayerCanUseChat(GetPlayer(), type, lang, msg, group))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND_LEADER, Language(lang), sender, nullptr, msg);
@@ -600,11 +568,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (Channel* chn = cMgr->GetChannel(channel, sender))
{
if (!sScriptMgr->OnPlayerCanUseChat(sender, type, lang, msg, chn))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(sender, type, lang, msg, chn);
chn->Say(sender->GetGUID(), msg.c_str(), lang);
}
@@ -633,11 +597,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
if (!sScriptMgr->OnPlayerCanUseChat(sender, type, lang, msg))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(sender, type, lang, msg);
}
break;
}
@@ -661,11 +621,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
}
if (!sScriptMgr->OnPlayerCanUseChat(sender, type, lang, msg))
- {
return;
- }
-
- sScriptMgr->OnPlayerChat(sender, type, lang, msg);
break;
}
@@ -803,7 +759,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData)
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_IGNORED, LANG_UNIVERSAL, _player, _player, GetPlayer()->GetName());
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
}
void WorldSession::HandleChannelDeclineInvite(WorldPacket& recvPacket)
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index 4ea3cb00e2..7f945eb175 100644
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp
index 88a3d7949b..ab34ee98bc 100644
--- a/src/server/game/Handlers/DuelHandler.cpp
+++ b/src/server/game/Handlers/DuelHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index c8f14779be..179a4469a8 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -149,7 +149,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
data << uint32(0); // unk
data << uint8(0); // count
data << uint32(0); // unk
- invitedPlayer->GetSession()->SendPacket(&data);
+ invitedPlayer->SendDirectMessage(&data);
}
return;
@@ -209,7 +209,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
data << uint32(0); // unk
data << uint8(0); // count
data << uint32(0); // unk
- invitedPlayer->GetSession()->SendPacket(&data);
+ invitedPlayer->SendDirectMessage(&data);
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK);
}
@@ -292,7 +292,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/)
// report
WorldPacket data(SMSG_GROUP_DECLINE, GetPlayer()->GetName().length());
data << GetPlayer()->GetName();
- leader->GetSession()->SendPacket(&data);
+ leader->SendDirectMessage(&data);
}
void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index eac43c69b5..35134009dd 100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 880440a3dc..9fc5643d0a 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -256,8 +256,8 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem&
}
// now do moves, remove...
- _player->RemoveItem(dstbag, dstslot, true, true);
- _player->RemoveItem(packet.SourceBag, packet.SourceSlot, true, true);
+ _player->RemoveItem(dstbag, dstslot, true);
+ _player->RemoveItem(packet.SourceBag, packet.SourceSlot, true);
// add to dest
_player->EquipItem(dest, pSrcItem, true);
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index 4a2fbbf1b5..934f6b84c6 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index f1b00066b5..50636f27c7 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -206,7 +206,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1);
data << uint32(goldPerPlayer);
data << uint8(playersNear.size() > 1 ? 0 : 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..."
- (*i)->GetSession()->SendPacket(&data);
+ (*i)->SendDirectMessage(&data);
}
}
else
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 76cb7fc0d1..bcf3701625 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 942eae9c54..c6485d813c 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -468,7 +468,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ
GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);
}
- GetPlayer()->SetRooted(true);
+ GetPlayer()->SetRooted(true, true, true);
GetPlayer()->SetUnitFlag(UNIT_FLAG_STUNNED);
}
@@ -492,7 +492,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCance
// not remove flags if can't free move - its not set in Logout request code.
if (GetPlayer()->CanFreeMove())
{
- GetPlayer()->SetRooted(false);
+ GetPlayer()->SetRooted(false, true, true);
GetPlayer()->SetStandState(UNIT_STAND_STATE_STAND);
GetPlayer()->RemoveUnitFlag(UNIT_FLAG_STUNNED);
@@ -656,7 +656,8 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(GameTime::GetGameTime().count()))
return;
- if (!corpse->IsWithinDistInMap(_player, CORPSE_RECLAIM_RADIUS, true))
+ // skip phase check
+ if (!corpse->IsInMap(_player) || !corpse->IsWithinDist(_player, CORPSE_RECLAIM_RADIUS, true))
return;
// resurrect
@@ -949,12 +950,6 @@ void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recv_data*/)
GetPlayer()->GetCinematicMgr()->BeginCinematic();
}
-void WorldSession::HandleFeatherFallAck(WorldPacket& recv_data)
-{
- // no used
- recv_data.rfinish(); // prevent warnings spam
-}
-
void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data)
{
uint8 ActionBar;
@@ -1144,45 +1139,18 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
LOG_DEBUG("network", "Received whois command from player {} for character {}", GetPlayer()->GetName(), charname);
}
-void WorldSession::HandleComplainOpcode(WorldPacket& recv_data)
+void WorldSession::HandleComplainOpcode(WorldPackets::Misc::Complain& packet)
{
LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN");
- uint8 spam_type; // 0 - mail, 1 - chat
- ObjectGuid spammer_guid;
- uint32 unk1 = 0;
- uint32 unk2 = 0;
- uint32 unk3 = 0;
- uint32 unk4 = 0;
- std::string description = "";
- recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat)
- recv_data >> spammer_guid; // player guid
- switch (spam_type)
- {
- case 0:
- recv_data >> unk1; // const 0
- recv_data >> unk2; // probably mail id
- recv_data >> unk3; // const 0
- break;
- case 1:
- recv_data >> unk1; // probably language
- recv_data >> unk2; // message type?
- recv_data >> unk3; // probably channel id
- recv_data >> unk4; // unk random value
- recv_data >> description; // spam description string (messagetype, channel name, player name, message)
- break;
- }
-
// NOTE: all chat messages from this spammer automatically ignored by spam reporter until logout in case chat spam.
// if it's mail spam - ALL mails from this spammer automatically removed by client
// Complaint Received message
- WorldPacket data(SMSG_COMPLAIN_RESULT, 1);
- data << uint8(0);
- SendPacket(&data);
+ SendPacket(WorldPackets::Misc::ComplainResult().Write());
LOG_DEBUG("network", "REPORT SPAM: type {}, {}, unk1 {}, unk2 {}, unk3 {}, unk4 {}, message {}",
- spam_type, spammer_guid.ToString(), unk1, unk2, unk3, unk4, description);
+ packet.SpamType, packet.SpammerGuid.ToString(), packet.Unk1, packet.Unk2, packet.Unk3, packet.Unk4, packet.Description);
}
void WorldSession::HandleRealmSplitOpcode(WorldPacket& recv_data)
@@ -1519,12 +1487,15 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recv_data*/)
_player->RemoveAurasByType(SPELL_AURA_MOUNTED);
}
-void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data)
+void WorldSession::HandleMoveFlagChangeOpcode(WorldPacket& recv_data)
{
- // fly mode on/off
- LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK");
+ LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging((Opcodes)recv_data.GetOpcode()));
+
+ Opcodes opcode = (Opcodes)recv_data.GetOpcode();
ObjectGuid guid;
+ uint32 counter;
+ uint32 isApplied;
recv_data >> guid.ReadAsPacked();
if (!_player)
@@ -1533,17 +1504,51 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data)
return;
}
- recv_data.read_skip<uint32>(); // unk
+ recv_data >> counter;
MovementInfo movementInfo;
movementInfo.guid = guid;
ReadMovementInfo(recv_data, &movementInfo);
- recv_data.read_skip<float>(); // unk2
+ if (opcode != CMSG_MOVE_GRAVITY_DISABLE_ACK && opcode != CMSG_MOVE_GRAVITY_ENABLE_ACK)
+ recv_data >> isApplied;
sScriptMgr->AnticheatSetCanFlybyServer(_player, movementInfo.HasMovementFlag(MOVEMENTFLAG_CAN_FLY));
- _player->m_mover->m_movementInfo.flags = movementInfo.GetMovementFlags();
+ Unit* mover = _player->m_mover;
+ Player* plrMover = mover->ToPlayer();
+
+ mover->m_movementInfo.flags = movementInfo.GetMovementFlags();
+
+ // old map - async processing, ignore
+ if (counter <= _player->GetMapChangeOrderCounter())
+ return;
+
+ if (!ProcessMovementInfo(movementInfo, mover, plrMover, recv_data))
+ {
+ recv_data.rfinish(); // prevent warnings spam
+ return;
+ }
+
+ if (_player->GetPendingFlightChange() == counter && opcode == CMSG_MOVE_SET_CAN_FLY_ACK)
+ _player->SetPendingFlightChange(false);
+
+ Opcodes response;
+
+ switch (recv_data.GetOpcode())
+ {
+ case CMSG_MOVE_HOVER_ACK: response = MSG_MOVE_HOVER; break;
+ case CMSG_MOVE_FEATHER_FALL_ACK: response = MSG_MOVE_FEATHER_FALL; break;
+ case CMSG_MOVE_WATER_WALK_ACK: response = MSG_MOVE_WATER_WALK; break;
+ case CMSG_MOVE_SET_CAN_FLY_ACK: response = MSG_MOVE_UPDATE_CAN_FLY; break;
+ case CMSG_MOVE_GRAVITY_DISABLE_ACK: response = MSG_MOVE_GRAVITY_CHNG; break;
+ case CMSG_MOVE_GRAVITY_ENABLE_ACK: response = MSG_MOVE_GRAVITY_CHNG; break;
+ default: return;
+ }
+
+ WorldPacket data(response, 8);
+ WriteMovementInfo(&data, &movementInfo);
+ _player->m_mover->SendMessageToSet(&data, _player);
}
void WorldSession::HandleRequestPetInfo(WorldPackets::Pet::RequestPetInfo& /*packet*/)
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 77b5bb43bd..fb40ce36ac 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -105,6 +105,13 @@ void WorldSession::HandleMoveWorldportAck()
GetPlayer()->UpdatePositionData();
GetPlayer()->SendInitialPacketsBeforeAddToMap();
+
+ if (GetPlayer()->GetPendingFlightChange() <= GetPlayer()->GetMapChangeOrderCounter())
+ {
+ if (!GetPlayer()->HasIncreaseMountedFlightSpeedAura() && !GetPlayer()->HasFlyAura())
+ GetPlayer()->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_CAN_FLY);
+ }
+
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
{
LOG_ERROR("network.opcode", "WORLD: failed to teleport player {} ({}) to map {} because of unknown reason!",
@@ -292,6 +299,8 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
plMover->UpdatePosition(dest, true);
+ plMover->SetFallInformation(GameTime::GetGameTime().count(), dest.GetPositionZ());
+
// xinef: teleport pets if they are not unsummoned
if (Pet* pet = plMover->GetPet())
{
@@ -370,15 +379,139 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
movementInfo.guid = guid;
ReadMovementInfo(recvData, &movementInfo);
- // Stop emote on move
- if (Player* plrMover = mover->ToPlayer())
+ if (!ProcessMovementInfo(movementInfo, mover, plrMover, recvData))
+ {
+ recvData.rfinish(); // prevent warnings spam
+ return;
+ }
+
+ if (opcode == CMSG_MOVE_FALL_RESET || opcode == CMSG_MOVE_CHNG_TRANSPORT)
+ return;
+
+ /* process position-change */
+ WorldPacket data(opcode, recvData.size());
+ WriteMovementInfo(&data, &movementInfo);
+ mover->SendMessageToSet(&data, _player);
+}
+
+void WorldSession::SynchronizeMovement(MovementInfo& movementInfo)
+{
+ int64 movementTime = (int64)movementInfo.time + _timeSyncClockDelta;
+ if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF)
+ {
+ LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead");
+ movementInfo.time = getMSTime();
+ }
+ else
+ {
+ movementInfo.time = (uint32)movementTime;
+ }
+}
+
+void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo, Unit* mover)
+{
+ SynchronizeMovement(movementInfo);
+
+ mover->UpdatePosition(movementInfo.pos);
+ mover->m_movementInfo = movementInfo;
+
+ if (mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
+ {
+ // if we boarded a transport, add us to it (generalized for both players and creatures)
+ if (!mover->GetTransport())
+ {
+ if (Transport* transport = mover->GetMap()->GetTransport(movementInfo.transport.guid))
+ {
+ mover->SetTransport(transport);
+ transport->AddPassenger(mover);
+ }
+ }
+ else if (mover->GetTransport()->GetGUID() != movementInfo.transport.guid)
+ {
+ // Switching transports
+ bool foundNewTransport = false;
+ mover->GetTransport()->RemovePassenger(mover);
+ if (Transport* transport = mover->GetMap()->GetTransport(movementInfo.transport.guid))
+ {
+ foundNewTransport = true;
+ mover->SetTransport(transport);
+ transport->AddPassenger(mover);
+ }
+
+ if (!foundNewTransport)
+ {
+ mover->SetTransport(nullptr);
+ movementInfo.transport.Reset();
+ }
+ }
+
+ if (!mover->GetTransport() && !mover->GetVehicle())
+ {
+ GameObject* go = mover->GetMap()->GetGameObject(movementInfo.transport.guid);
+ if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
+ movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
+ }
+ }
+ else
{
- if (plrMover->GetUInt32Value(UNIT_NPC_EMOTESTATE) != EMOTE_ONESHOT_NONE && movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING))
+ // if we were on a transport, leave (handles both players and creatures)
+ if (Transport* transport = mover->GetTransport())
{
- plrMover->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
+ if (mover->IsPlayer())
+ sScriptMgr->AnticheatSetUnderACKmount(mover->ToPlayer()); // just for safe
+
+ transport->RemovePassenger(mover);
+ mover->SetTransport(nullptr);
+ movementInfo.transport.Reset();
}
}
+ // Some vehicles allow the passenger to turn by himself
+ if (Vehicle* vehicle = mover->GetVehicle())
+ {
+ if (VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(mover))
+ {
+ if (seat->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING && movementInfo.pos.GetOrientation() != mover->GetOrientation())
+ {
+ mover->SetOrientation(movementInfo.pos.GetOrientation());
+ mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
+ }
+ }
+ }
+
+ if (Player* plrMover = mover->ToPlayer()) // nothing is charmed, or player charmed
+ {
+ if (plrMover->IsSitState() && (movementInfo.flags & (MOVEMENTFLAG_MASK_MOVING | MOVEMENTFLAG_MASK_TURNING)))
+ plrMover->SetStandState(UNIT_STAND_STATE_STAND);
+
+ if (movementInfo.pos.GetPositionZ() < plrMover->GetMap()->GetMinHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()))
+ {
+ if (!plrMover->GetBattleground() || !plrMover->GetBattleground()->HandlePlayerUnderMap(_player))
+ {
+ if (plrMover->IsAlive())
+ {
+ plrMover->SetPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS);
+ plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
+ // player can be alive if GM
+ if (plrMover->IsAlive())
+ plrMover->KillPlayer();
+ }
+ else if (!plrMover->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS))
+ {
+ GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover, plrMover->GetTeamId());
+ if (grave)
+ {
+ plrMover->TeleportTo(grave->Map, grave->x, grave->y, grave->z, plrMover->GetOrientation());
+ plrMover->Relocate(grave->x, grave->y, grave->z, plrMover->GetOrientation());
+ }
+ }
+ }
+ }
+ }
+}
+
+bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, Player* plrMover, Unit* mover, Opcodes opcode) const
+{
if (!movementInfo.pos.IsPositionValid())
{
if (plrMover)
@@ -386,14 +519,13 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
}
- recvData.rfinish(); // prevent warnings spam
- return;
+ return false;
}
if (!mover->movespline->Finalized())
{
- recvData.rfinish(); // prevent warnings spam
- return;
+ if (!mover->movespline->isBoarding() || (opcode != CMSG_FORCE_MOVE_UNROOT_ACK && opcode != CMSG_FORCE_MOVE_ROOT_ACK))
+ return false;
}
// Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE
@@ -406,18 +538,28 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
}
- return;
+ return false;
}
- movementInfo.pos.Relocate(mover->GetPositionX(), mover->GetPositionY(), mover->GetPositionZ());
+ }
- if (mover->IsCreature())
+ bool jumpopcode = false;
+ if (opcode == MSG_MOVE_JUMP)
+ {
+ jumpopcode = true;
+ if (plrMover && !sScriptMgr->AnticheatHandleDoubleJump(plrMover, mover))
{
- movementInfo.transport.guid = mover->m_movementInfo.transport.guid;
- movementInfo.transport.pos.Relocate(mover->m_movementInfo.transport.pos.GetPositionX(), mover->m_movementInfo.transport.pos.GetPositionY(), mover->m_movementInfo.transport.pos.GetPositionZ());
- movementInfo.transport.seat = mover->m_movementInfo.transport.seat;
+ plrMover->GetSession()->KickPlayer();
+ return false;
}
}
+ /* start some hack detection */
+ if (plrMover && !sScriptMgr->AnticheatCheckMovementInfo(plrMover, movementInfo, mover, jumpopcode))
+ {
+ plrMover->GetSession()->KickPlayer();
+ return false;
+ }
+
if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
{
// We were teleported, skip packets that were broadcast before teleport
@@ -428,68 +570,45 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
//LOG_INFO("anticheat", "MovementHandler:: 2 We were teleported, skip packets that were broadcast before teleport");
}
- recvData.rfinish(); // prevent warnings spam
- return;
+ return false;
}
if (!Acore::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.transport.pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.transport.pos.GetPositionY(),
- movementInfo.pos.GetPositionZ() + movementInfo.transport.pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.transport.pos.GetOrientation()))
+ movementInfo.pos.GetPositionZ() + movementInfo.transport.pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.transport.pos.GetOrientation()))
{
if (plrMover)
{
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
}
- recvData.rfinish(); // prevent warnings spam
- return;
+ return false;
}
+ }
- // if we boarded a transport, add us to it
- if (plrMover)
- {
- if (!plrMover->GetTransport())
- {
- if (Transport* transport = plrMover->GetMap()->GetTransport(movementInfo.transport.guid))
- {
- plrMover->m_transport = transport;
- transport->AddPassenger(plrMover);
- }
- }
- else if (plrMover->GetTransport()->GetGUID() != movementInfo.transport.guid)
- {
- bool foundNewTransport = false;
- plrMover->m_transport->RemovePassenger(plrMover);
- if (Transport* transport = plrMover->GetMap()->GetTransport(movementInfo.transport.guid))
- {
- foundNewTransport = true;
- plrMover->m_transport = transport;
- transport->AddPassenger(plrMover);
- }
+ // rooted mover sent packet without root or moving AND root - ignore, due to client crash possibility
+ if (opcode != CMSG_FORCE_MOVE_UNROOT_ACK)
+ if (mover->IsRooted() && (!movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT) || movementInfo.HasMovementFlag(MOVEMENTFLAG_MASK_MOVING)))
+ return false;
- if (!foundNewTransport)
- {
- plrMover->m_transport = nullptr;
- movementInfo.transport.Reset();
- }
- }
- }
+ return true;
+}
- if (!mover->GetTransport() && !mover->GetVehicle())
- {
- GameObject* go = mover->GetMap()->GetGameObject(movementInfo.transport.guid);
- if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
- {
- movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
- }
- }
- }
- else if (plrMover && plrMover->GetTransport()) // if we were on a transport, leave
+bool WorldSession::ProcessMovementInfo(MovementInfo& movementInfo, Unit* mover, Player* plrMover, WorldPacket& recvData)
+{
+ Opcodes opcode = (Opcodes)recvData.GetOpcode();
+ if (!VerifyMovementInfo(movementInfo, plrMover, mover, opcode))
+ return false;
+
+ if (mover->HasUnitFlag(UNIT_FLAG_DISABLE_MOVE))
{
- sScriptMgr->AnticheatSetUnderACKmount(plrMover); // just for safe
+ movementInfo.pos.Relocate(mover->GetPositionX(), mover->GetPositionY(), mover->GetPositionZ());
- plrMover->m_transport->RemovePassenger(plrMover);
- plrMover->m_transport = nullptr;
- movementInfo.transport.Reset();
+ if (mover->IsCreature())
+ {
+ movementInfo.transport.guid = mover->m_movementInfo.transport.guid;
+ movementInfo.transport.pos.Relocate(mover->m_movementInfo.transport.pos.GetPositionX(), mover->m_movementInfo.transport.pos.GetPositionY(), mover->m_movementInfo.transport.pos.GetPositionZ());
+ movementInfo.transport.seat = mover->m_movementInfo.transport.seat;
+ }
}
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
@@ -523,89 +642,19 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
sScriptMgr->OnPlayerMove(plrMover, movementInfo, opcode);
}
- bool jumpopcode = false;
- if (opcode == MSG_MOVE_JUMP)
- {
- jumpopcode = true;
- if (plrMover && !sScriptMgr->AnticheatHandleDoubleJump(plrMover, mover))
- {
- plrMover->GetSession()->KickPlayer();
- return;
- }
- }
-
- /* start some hack detection */
- if (plrMover && !sScriptMgr->AnticheatCheckMovementInfo(plrMover, movementInfo, mover, jumpopcode))
- {
- plrMover->GetSession()->KickPlayer();
- return;
- }
-
- /* process position-change */
- WorldPacket data(opcode, recvData.size());
- int64 movementTime = (int64)movementInfo.time + _timeSyncClockDelta;
- if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF)
- {
- LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead");
- movementInfo.time = getMSTime();
- }
- else
+ if (movementInfo.GetMovementFlags() & MOVEMENTFLAG_MASK_MOVING_OR_TURN)
{
- movementInfo.time = (uint32) movementTime;
+ if (mover->IsStandState())
+ mover->SetStandState(UNIT_STAND_STATE_STAND);
+ mover->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
}
- movementInfo.guid = mover->GetGUID();
- WriteMovementInfo(&data, &movementInfo);
- mover->SendMessageToSet(&data, _player);
-
- mover->m_movementInfo = movementInfo;
-
- // Some vehicles allow the passenger to turn by himself
- if (Vehicle* vehicle = mover->GetVehicle())
- {
- if (VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(mover))
- {
- if (seat->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING && movementInfo.pos.GetOrientation() != mover->GetOrientation())
- {
- mover->SetOrientation(movementInfo.pos.GetOrientation());
- mover->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TURNING);
- }
- }
-
- return;
- }
-
- mover->UpdatePosition(movementInfo.pos);
-
- if (plrMover) // nothing is charmed, or player charmed
- {
- if (plrMover->IsSitState() && (movementInfo.flags & (MOVEMENTFLAG_MASK_MOVING | MOVEMENTFLAG_MASK_TURNING)))
- plrMover->SetStandState(UNIT_STAND_STATE_STAND);
+ HandleMoverRelocation(movementInfo, mover);
+ if (plrMover && opcode != CMSG_MOVE_KNOCK_BACK_ACK)
plrMover->UpdateFallInformationIfNeed(movementInfo, opcode);
- if (movementInfo.pos.GetPositionZ() < plrMover->GetMap()->GetMinHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()))
- if (!plrMover->GetBattleground() || !plrMover->GetBattleground()->HandlePlayerUnderMap(_player))
- {
- if (plrMover->IsAlive())
- {
- plrMover->SetPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS);
- plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
- // player can be alive if GM
- if (plrMover->IsAlive())
- plrMover->KillPlayer();
- }
- else if (!plrMover->HasPlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS))
- {
- GraveyardStruct const* grave = sGraveyard->GetClosestGraveyard(plrMover, plrMover->GetTeamId());
- if (grave)
- {
- plrMover->TeleportTo(grave->Map, grave->x, grave->y, grave->z, plrMover->GetOrientation());
- plrMover->Relocate(grave->x, grave->y, grave->z, plrMover->GetOrientation());
- }
- }
- }
- }
+ return true;
}
void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
@@ -615,26 +664,43 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
/* extract packet */
ObjectGuid guid;
- uint32 unk1;
+ uint32 counter;
+ MovementInfo movementInfo;
float newspeed;
recvData >> guid.ReadAsPacked();
+ recvData >> counter; // counter or moveEvent
+ movementInfo.guid = guid;
+ ReadMovementInfo(recvData, &movementInfo);
+ recvData >> newspeed;
+
+ Unit* mover = _player->m_mover;
// pussywizard: special check, only player mover allowed here
- if (guid != _player->m_mover->GetGUID() || guid != _player->GetGUID())
+ if (guid != mover->GetGUID() || guid != _player->GetGUID())
{
recvData.rfinish(); // prevent warnings spam
return;
}
- // continue parse packet
- recvData >> unk1; // counter or moveEvent
+ // old map - async processing, ignore
+ if (counter <= _player->GetMapChangeOrderCounter())
+ return;
- MovementInfo movementInfo;
- movementInfo.guid = guid;
- ReadMovementInfo(recvData, &movementInfo);
+ if (!ProcessMovementInfo(movementInfo, mover, _player, recvData))
+ {
+ recvData.rfinish(); // prevent warnings spam
+ return;
+ }
- recvData >> newspeed;
+ if (opcode == CMSG_MOVE_SET_COLLISION_HGT_ACK)
+ {
+ WorldPacket data(MSG_MOVE_SET_COLLISION_HGT, 18);
+ WriteMovementInfo(&data, &movementInfo);
+ data << newspeed; // new collision height
+ mover->SendMessageToSet(&data, _player);
+ return;
+ }
// client ACK send one packet for mounted/run case and need skip all except last from its
// in other cases anti-cheat check can be fail in false case
@@ -645,42 +711,15 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
switch (opcode)
{
- case CMSG_FORCE_WALK_SPEED_CHANGE_ACK:
- move_type = MOVE_WALK;
- force_move_type = MOVE_WALK;
- break;
- case CMSG_FORCE_RUN_SPEED_CHANGE_ACK:
- move_type = MOVE_RUN;
- force_move_type = MOVE_RUN;
- break;
- case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK:
- move_type = MOVE_RUN_BACK;
- force_move_type = MOVE_RUN_BACK;
- break;
- case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK:
- move_type = MOVE_SWIM;
- force_move_type = MOVE_SWIM;
- break;
- case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK:
- move_type = MOVE_SWIM_BACK;
- force_move_type = MOVE_SWIM_BACK;
- break;
- case CMSG_FORCE_TURN_RATE_CHANGE_ACK:
- move_type = MOVE_TURN_RATE;
- force_move_type = MOVE_TURN_RATE;
- break;
- case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK:
- move_type = MOVE_FLIGHT;
- force_move_type = MOVE_FLIGHT;
- break;
- case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK:
- move_type = MOVE_FLIGHT_BACK;
- force_move_type = MOVE_FLIGHT_BACK;
- break;
- case CMSG_FORCE_PITCH_RATE_CHANGE_ACK:
- move_type = MOVE_PITCH_RATE;
- force_move_type = MOVE_PITCH_RATE;
- break;
+ case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
+ case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break;
+ case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = MOVE_RUN_BACK; force_move_type = MOVE_RUN_BACK; break;
+ case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; force_move_type = MOVE_SWIM; break;
+ case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = MOVE_SWIM_BACK; force_move_type = MOVE_SWIM_BACK; break;
+ case CMSG_FORCE_TURN_RATE_CHANGE_ACK: move_type = MOVE_TURN_RATE; force_move_type = MOVE_TURN_RATE; break;
+ case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT; force_move_type = MOVE_FLIGHT; break;
+ case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break;
+ case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; force_move_type = MOVE_PITCH_RATE; break;
default:
LOG_ERROR("network.opcode", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: {}", opcode);
return;
@@ -688,6 +727,12 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
sScriptMgr->AnticheatSetUnderACKmount(_player);
+ SpeedOpcodePair const& speedOpcodes = SetSpeed2Opc_table[move_type];
+ WorldPacket data(speedOpcodes[static_cast<size_t>(SpeedOpcodeIndex::ACK_RESPONSE)], 18);
+ WriteMovementInfo(&data, &movementInfo);
+ data << newspeed;
+ mover->SendMessageToSet(&data, _player);
+
// skip all forced speed changes except last and unexpected
// in run/mounted case used one ACK and it must be skipped.m_forced_speed_changes[MOVE_RUN} store both.
if (_player->m_forced_speed_changes[force_move_type] > 0)
@@ -762,11 +807,13 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
{
LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK");
+ Unit* mover = _player->m_mover;
+
ObjectGuid guid;
recvData >> guid.ReadAsPacked();
// pussywizard: typical check for incomming movement packets
- if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID())
+ if (!mover || !mover->IsInWorld() || mover->IsDuringRemoveFromWorld() || guid != mover->GetGUID())
{
recvData.rfinish(); // prevent warnings spam
return;
@@ -778,7 +825,10 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
movementInfo.guid = guid;
ReadMovementInfo(recvData, &movementInfo);
- _player->m_mover->m_movementInfo = movementInfo;
+ mover->m_movementInfo = movementInfo;
+
+ if (mover->IsPlayer() && static_cast<Player*>(mover)->IsFreeFlying())
+ mover->SetCanFly(true);
WorldPacket data(MSG_MOVE_KNOCK_BACK, 66);
data << guid.WriteAsPacked();
@@ -793,38 +843,6 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
_player->SendMessageToSet(&data, false);
}
-void WorldSession::HandleMoveHoverAck(WorldPacket& recvData)
-{
- LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK");
-
- ObjectGuid guid;
- recvData >> guid.ReadAsPacked();
-
- recvData.read_skip<uint32>(); // unk
-
- MovementInfo movementInfo;
- movementInfo.guid = guid;
- ReadMovementInfo(recvData, &movementInfo);
-
- recvData.read_skip<uint32>(); // unk2
-}
-
-void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData)
-{
- LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK");
-
- ObjectGuid guid;
- recvData >> guid.ReadAsPacked();
-
- recvData.read_skip<uint32>(); // unk
-
- MovementInfo movementInfo;
- movementInfo.guid = guid;
- ReadMovementInfo(recvData, &movementInfo);
-
- recvData.read_skip<uint32>(); // unk2
-}
-
void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
{
if (!_player->IsAlive() || _player->IsInCombat())
@@ -954,79 +972,44 @@ void WorldSession::ComputeNewClockDelta()
void WorldSession::HandleMoveRootAck(WorldPacket& recvData)
{
- ObjectGuid guid;
- recvData >> guid.ReadAsPacked();
-
- Unit* mover = _player->m_mover;
- if (!mover || guid != mover->GetGUID())
- {
- recvData.rfinish(); // prevent warnings spam
- return;
- }
-
- uint32 movementCounter;
- recvData >> movementCounter;
+ Opcodes opcode = (Opcodes)recvData.GetOpcode();
+ LOG_DEBUG("network", "WORLD: {}", GetOpcodeNameForLogging(opcode));
+ ObjectGuid guid;
+ uint32 counter;
MovementInfo movementInfo;
+ recvData >> guid.ReadAsPacked();
+ recvData >> counter;
movementInfo.guid = guid;
ReadMovementInfo(recvData, &movementInfo);
- /* process position-change */
- int64 movementTime = (int64) movementInfo.time + _timeSyncClockDelta;
- if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF)
- {
- LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead");
- movementInfo.time = getMSTime();
- }
- else
- {
- movementInfo.time = (uint32)movementTime;
- }
-
- movementInfo.guid = mover->GetGUID();
- mover->m_movementInfo = movementInfo;
- mover->UpdatePosition(movementInfo.pos);
-
-}
-
-void WorldSession::HandleMoveUnRootAck(WorldPacket& recvData)
-{
- ObjectGuid guid;
- recvData >> guid.ReadAsPacked();
-
Unit* mover = _player->m_mover;
- if (!mover || guid != mover->GetGUID())
- {
- recvData.rfinish(); // prevent warnings spam
- return;
- }
-
- uint32 movementCounter;
- recvData >> movementCounter;
- MovementInfo movementInfo;
- movementInfo.guid = guid;
- ReadMovementInfo(recvData, &movementInfo);
+ if (mover->GetGUID() != guid)
+ return;
- /* process position-change */
- int64 movementTime = (int64) movementInfo.time + _timeSyncClockDelta;
- if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF)
+ if (opcode == CMSG_FORCE_MOVE_UNROOT_ACK) // unroot case
{
- LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead");
- movementInfo.time = getMSTime();
+ if (!mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT))
+ return;
}
- else
+ else // root case
{
- movementInfo.time = (uint32)movementTime;
+ if (mover->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT))
+ return;
}
- if (G3D::fuzzyEq(movementInfo.fallTime, 0.f))
- {
- movementInfo.RemoveMovementFlag(MOVEMENTFLAG_FALLING);
- }
+ // old map - async processing, ignore
+ if (counter <= _player->GetMapChangeOrderCounter())
+ return;
- movementInfo.guid = mover->GetGUID();
- mover->m_movementInfo = movementInfo;
- mover->UpdatePosition(movementInfo.pos);
+ if (!ProcessMovementInfo(movementInfo, mover, _player, recvData))
+ return;
+
+ if (_player->IsExpectingChangeTransport())
+ return;
+ WorldPacket data(opcode == CMSG_FORCE_MOVE_UNROOT_ACK ? MSG_MOVE_UNROOT : MSG_MOVE_ROOT);
+ WriteMovementInfo(&data, &movementInfo);
+ mover->SendMessageToSet(&data, _player);
}
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index b969e81057..66b7d01af1 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/NPCHandler.h b/src/server/game/Handlers/NPCHandler.h
index 9a4511d008..1cdb7cd14f 100644
--- a/src/server/game/Handlers/NPCHandler.h
+++ b/src/server/game/Handlers/NPCHandler.h
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 38b66926e5..d445be9ed7 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -262,8 +262,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
pet->ToCreature()->AI()->AttackStart(TargetUnit);
//10% chance to play special pet attack talk, else growl
- if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
- pet->SendPetTalk((uint32)PET_TALK_ATTACK);
+ if (pet->IsPet() && pet->ToPet()->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10))
+ pet->SendPetActionSound(PET_ACTION_ATTACK);
else
{
// 90% chance for pet and 100% chance for charmed creature
@@ -297,8 +297,11 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
if (pet->ToPet()->getPetType() == HUNTER_PET)
GetPlayer()->RemovePet(pet->ToPet(), PET_SAVE_AS_DELETED);
else
+ {
+ pet->SendPetDismissSound();
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
pet->setDeathState(DeathState::Corpse);
+ }
}
else if (pet->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_SUMMON | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLLABLE_GUARDIAN))
{
@@ -413,8 +416,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
//10% chance to play special pet attack talk, else growl
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
- if (pet->IsPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
- pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
+ if (pet->IsPet() && (pet->ToPet()->getPetType() == SUMMON_PET) && (pet != unit_target) && roll_chance_i(10))
+ pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL);
else
{
pet->SendPetAIReaction(guid1);
@@ -509,8 +512,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
pet->ToCreature()->AI()->AttackStart(TargetUnit);
- if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
- pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
+ if (pet->IsPet() && pet->ToPet()->getPetType() == SUMMON_PET && pet != TargetUnit && roll_chance_i(10))
+ pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL);
else
pet->SendPetAIReaction(guid1);
}
@@ -558,8 +561,8 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
pet->GetMotionMaster()->MoveFollow(unit_target, PET_FOLLOW_DIST, rand_norm() * 2 * M_PI);
- if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != unit_target && urand(0, 100) < 10)
- pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
+ if (pet->IsPet() && pet->ToPet()->getPetType() == SUMMON_PET && pet != unit_target && roll_chance_i(10))
+ pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL);
else
{
pet->SendPetAIReaction(guid1);
@@ -1059,8 +1062,8 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
{
// 10% chance to play special pet attack talk, else growl
// actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
- if (pet->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
- pet->SendPetTalk(PET_TALK_SPECIAL_SPELL);
+ if (pet->getPetType() == SUMMON_PET && roll_chance_i(10))
+ pet->SendPetActionSound(PET_ACTION_SPECIAL_SPELL);
else
pet->SendPetAIReaction(guid);
}
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 7ff2091d40..7ce5870153 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -494,7 +494,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
// update for owner if online
if (Player* owner = ObjectAccessor::FindConnectedPlayer(petition->ownerGuid))
- owner->GetSession()->SendPacket(&data);
+ owner->SendDirectMessage(&data);
return;
}
@@ -527,7 +527,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
// update for owner if online
if (Player* owner = ObjectAccessor::FindConnectedPlayer(petition->ownerGuid))
- owner->GetSession()->SendPacket(&data);
+ owner->SendDirectMessage(&data);
}
void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
@@ -547,7 +547,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
{
WorldPacket data(MSG_PETITION_DECLINE, 8);
data << _player->GetGUID();
- owner->GetSession()->SendPacket(&data);
+ owner->SendDirectMessage(&data);
}
}
@@ -639,7 +639,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
data << uint32(0); // there 0 ...
}
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
}
void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index 604977301b..478dbe5abe 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 80063d6382..946d23b851 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -625,7 +625,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
WorldPacket data(MSG_QUEST_PUSH_RESULT, 8 + 4 + 1);
data << _player->GetGUID();
data << uint8(msg); // valid values: 0-8
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
_player->SetDivider();
}
}
diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp
index e616d7b47b..20d17e86fd 100644
--- a/src/server/game/Handlers/ReferAFriendHandler.cpp
+++ b/src/server/game/Handlers/ReferAFriendHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -60,7 +60,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
WorldPacket data2(SMSG_PROPOSE_LEVEL_GRANT, 8);
data2 << _player->GetPackGUID();
- target->GetSession()->SendPacket(&data2);
+ target->SendDirectMessage(&data2);
}
void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index 5768900cc5..0cc383454b 100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/Socialhandler.cpp b/src/server/game/Handlers/Socialhandler.cpp
index 5a4557cc95..6fccfa1d30 100644
--- a/src/server/game/Handlers/Socialhandler.cpp
+++ b/src/server/game/Handlers/Socialhandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 6117637db6..0ab498b43b 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index 8a76a2bd63..4fd089b6b2 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -198,54 +198,70 @@ void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData)
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
{
- ObjectGuid guid; // used only for proper packet read
- recvData >> guid.ReadAsPacked();
-
- MovementInfo movementInfo; // used only for proper packet read
- movementInfo.guid = guid;
- ReadMovementInfo(recvData, &movementInfo);
+ ObjectGuid guid; // used only for proper packet read
+ MovementInfo movementInfo; // used only for proper packet read
+ uint32 movementCounter; // spline counter
- recvData.read_skip<uint32>(); // spline id
+ Unit* mover = _player->m_mover;
- // in taxi flight packet received in 2 case:
- // 1) end taxi path in far (multi-node) flight
- // 2) switch from one map to other in case multim-map taxi path
- // we need process only (1)
+ recvData >> guid.ReadAsPacked();
+ ReadMovementInfo(recvData, &movementInfo);
+ recvData >> movementCounter;
- uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
- if (curDest)
+ if (_player->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT)) // taxi spline case
{
- TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
+ // in taxi flight packet received in 2 case:
+ // 1) end taxi path in far (multi-node) flight
+ // 2) switch from one map to other in case multim-map taxi path
+ // we need process only (1)
- // far teleport case
- if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
+ uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
+ if (curDest)
{
- if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top()))
- {
- // short preparations to continue flight
- flight->SetCurrentNodeAfterTeleport();
- TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
- flight->SkipCurrentNode();
+ TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
- GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI);
+ // far teleport case
+ if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
+ {
+ if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top()))
+ {
+ // short preparations to continue flight
+ flight->SetCurrentNodeAfterTeleport();
+ TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
+ flight->SkipCurrentNode();
+
+ GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI);
+ }
}
+
+ return;
}
+ // at this point only 1 node is expected (final destination)
+ if (GetPlayer()->m_taxi.GetPath().size() != 1)
+ {
+ return;
+ }
+
+ GetPlayer()->CleanupAfterTaxiFlight();
+ GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ());
+ if (GetPlayer()->pvpInfo.IsHostile)
+ {
+ GetPlayer()->CastSpell(GetPlayer(), 2479, true);
+ }
return;
}
- // at this point only 1 node is expected (final destination)
- if (GetPlayer()->m_taxi.GetPath().size() != 1)
- {
+ if (mover->GetGUID() != guid)
return;
- }
- GetPlayer()->CleanupAfterTaxiFlight();
- GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ());
- if (GetPlayer()->pvpInfo.IsHostile)
- {
- GetPlayer()->CastSpell(GetPlayer(), 2479, true);
- }
+ if (!_player->IsExpectingChangeTransport() || !mover->movespline || mover->movespline->GetId() != movementCounter)
+ return;
+
+ _player->SetExpectingChangeTransport(false);
+ WorldPacket data(_player->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_ROOT) ? MSG_MOVE_ROOT : MSG_MOVE_UNROOT, recvData.size());
+ WriteMovementInfo(&data, &movementInfo);
+ mover->SendMessageToSet(&data, _player);
}
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index 089546aa51..9ab4fb3442 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index ce316965ef..6bef09eb0e 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -646,7 +646,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
WorldPacket data(SMSG_TRADE_STATUS, 12);
data << uint32(TRADE_STATUS_BEGIN_TRADE);
data << _player->GetGUID();
- pOther->GetSession()->SendPacket(&data);
+ pOther->SendDirectMessage(&data);
}
void WorldSession::HandleSetTradeGoldOpcode(WorldPacket& recvPacket)
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index 180cb6c293..4df63ad67f 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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
@@ -50,7 +50,10 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData)
mi.guid = guid;
ReadMovementInfo(recvData, &mi);
- _player->m_mover->m_movementInfo = mi;
+ if (_player->m_mover->IsRooted()) // for some reason client sends it without it even if rooted
+ mi.AddMovementFlag(MOVEMENTFLAG_ROOT);
+
+ ProcessMovementInfo(mi, _player->m_mover, _player->m_mover->ToPlayer(), recvData);
_player->ExitVehicle();
}
diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp
index 1badb072f4..c81eff848d 100644
--- a/src/server/game/Handlers/VoiceChatHandler.cpp
+++ b/src/server/game/Handlers/VoiceChatHandler.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore 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 Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * 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 Affero General Public License for
+ * 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