Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-12-12 20:52:42 +08:00
1088 changed files with 35633 additions and 19812 deletions

View File

@@ -62,8 +62,6 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_ARENA_TEAM_QUERY");
uint32 arenaTeamId;
recvData >> arenaTeamId;
@@ -76,8 +74,6 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData)
void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_ARENA_TEAM_ROSTER");
uint32 arenaTeamId; // arena team id
recvData >> arenaTeamId;

View File

@@ -395,8 +395,6 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
//this function is called when client bids or buys out auction
void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID");
ObjectGuid auctioneer;
uint32 auctionId;
uint32 price;
@@ -528,8 +526,6 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
//this void is called when auction_owner cancels his auction
void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
ObjectGuid auctioneer;
uint32 auctionId;
recvData >> auctioneer;
@@ -603,8 +599,6 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
//called when player lists his bids
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
ObjectGuid guid; //NPC guid
uint32 listfrom; //page of auctions
uint32 outbiddedCount; //count of outbidded auctions
@@ -683,8 +677,6 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
void WorldSession::HandleAuctionListOwnerItemsEvent(ObjectGuid creatureGuid)
{
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
_lastAuctionListOwnerItemsMSTime = GameTime::GetGameTimeMS(); // pussywizard
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(creatureGuid, UNIT_NPC_FLAG_AUCTIONEER);
@@ -716,8 +708,6 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(ObjectGuid creatureGuid)
//this void is called when player clicks on search button
void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_ITEMS");
std::string searchedname;
uint8 levelmin, levelmax, usable;
uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
@@ -773,8 +763,6 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES");
recvData.read_skip<uint64>();
uint32 count = 0;

View File

@@ -46,8 +46,6 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
{
ObjectGuid guid;
LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE");
recvData >> guid;
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);

View File

@@ -23,6 +23,7 @@
#include "DisableMgr.h"
#include "GameTime.h"
#include "Group.h"
#include "LFGMgr.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "Opcodes.h"

View File

@@ -35,6 +35,7 @@
#include "Log.h"
#include "MapMgr.h"
#include "Metric.h"
#include "MotdMgr.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
@@ -45,7 +46,6 @@
#include "Realm.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "MotdMgr.h"
#include "SharedDefines.h"
#include "SocialMgr.h"
#include "SpellAuraEffects.h"
@@ -527,7 +527,11 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
std::shared_ptr<Player> newChar(new Player(this), [](Player* ptr)
{
ptr->CleanupsBeforeDelete();
// Only when player is created correctly do clean
if (ptr->HasAtLoginFlag(AT_LOGIN_FIRST))
{
ptr->CleanupsBeforeDelete();
}
delete ptr;
});
@@ -932,7 +936,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
pCurrChar->LoadCorpse(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION));
// setting Ghost+speed if dead
if (pCurrChar->m_deathState != ALIVE)
if (pCurrChar->m_deathState != DeathState::Alive)
{
// not blizz like, we must correctly save and load player instead...
if (pCurrChar->getRace() == RACE_NIGHTELF)
@@ -1239,8 +1243,6 @@ void WorldSession::HandlePlayerLoginToCharOutOfWorld(Player* /*pCurrChar*/)
void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData)
{
LOG_DEBUG("network.opcode", "WORLD: Received CMSG_SET_FACTION_ATWAR");
uint32 repListID;
uint8 flag;
@@ -1287,7 +1289,6 @@ void WorldSession::HandleTutorialReset(WorldPacket& /*recvData*/)
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network.opcode", "WORLD: Received CMSG_SET_WATCHED_FACTION");
uint32 fact;
recvData >> fact;
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact);
@@ -1295,7 +1296,6 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData)
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network.opcode", "WORLD: Received CMSG_SET_FACTION_INACTIVE");
uint32 replistid;
uint8 inactive;
recvData >> replistid >> inactive;

View File

@@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureAI.h"
#include "CombatPackets.h"
#include "CreatureAI.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectDefines.h"

View File

@@ -52,7 +52,6 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
{
LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_CANCELLED");
Player* player = GetPlayer();
ObjectGuid guid;

View File

@@ -18,11 +18,12 @@
#include "DatabaseEnv.h"
#include "Group.h"
#include "GroupMgr.h"
#include "LFGMgr.h"
#include "Language.h"
#include "Log.h"
#include "MiscPackets.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "MiscPackets.h"
#include "Pet.h"
#include "Player.h"
#include "ScriptMgr.h"
@@ -60,8 +61,6 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string&
void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_INVITE");
std::string membername;
recvData >> membername;
recvData.read_skip<uint32>();
@@ -75,81 +74,73 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
return;
}
Player* player = ObjectAccessor::FindPlayerByName(membername, false);
Player* invitingPlayer = GetPlayer();
Player* invitedPlayer = ObjectAccessor::FindPlayerByName(membername, false);
// no player or cheat self-invite
if (!player || player == GetPlayer())
if (!invitedPlayer || invitedPlayer == invitingPlayer)
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
return;
}
if (!sScriptMgr->CanGroupInvite(GetPlayer(), membername))
if (!sScriptMgr->CanGroupInvite(invitingPlayer, membername))
return;
if (GetPlayer()->IsSpectator() || player->IsSpectator())
if (invitingPlayer->IsSpectator() || invitedPlayer->IsSpectator())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_INVITE_RESTRICTED);
return;
}
// restrict invite to GMs
if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !GetPlayer()->IsGameMaster() && player->IsGameMaster())
if (!sWorld->getBoolConfig(CONFIG_ALLOW_GM_GROUP) && !invitingPlayer->IsGameMaster() && invitedPlayer->IsGameMaster())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S);
return;
}
// can't group with
if (!GetPlayer()->IsGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeamId() != player->GetTeamId())
if (!invitingPlayer->IsGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && invitingPlayer->GetTeamId() != invitedPlayer->GetTeamId())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION);
return;
}
if (GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId())
if (invitingPlayer->GetInstanceId() != 0 && invitedPlayer->GetInstanceId() != 0 && invitingPlayer->GetInstanceId() != invitedPlayer->GetInstanceId() && invitingPlayer->GetMapId() == invitedPlayer->GetMapId())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_TARGET_NOT_IN_INSTANCE_S);
return;
}
// just ignore us
if (player->GetInstanceId() != 0 && player->GetDungeonDifficulty() != GetPlayer()->GetDungeonDifficulty())
if (invitedPlayer->GetInstanceId() != 0 && invitedPlayer->GetDungeonDifficulty() != invitingPlayer->GetDungeonDifficulty())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S);
return;
}
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUID()))
if (invitedPlayer->GetSocial()->HasIgnore(invitingPlayer->GetGUID()))
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S);
return;
}
if (!player->GetSocial()->HasFriend(GetPlayer()->GetGUID()) && GetPlayer()->GetLevel() < sWorld->getIntConfig(CONFIG_PARTY_LEVEL_REQ))
if (!invitedPlayer->GetSocial()->HasFriend(invitingPlayer->GetGUID()) && invitingPlayer->GetLevel() < sWorld->getIntConfig(CONFIG_PARTY_LEVEL_REQ))
{
SendPartyResult(PARTY_OP_INVITE, player->GetName(), ERR_INVITE_RESTRICTED);
SendPartyResult(PARTY_OP_INVITE, invitedPlayer->GetName(), ERR_INVITE_RESTRICTED);
return;
}
Group* group = GetPlayer()->GetGroup();
if (group)
{
if (group->isLFGGroup() && group->IsLfgRandomInstance())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_TARGET_NOT_IN_INSTANCE_S);
return;
}
Group* group = invitingPlayer->GetGroup();
if (group && group->isBGGroup())
group = invitingPlayer->GetOriginalGroup();
if (!group)
group = invitingPlayer->GetGroupInvite();
if (group->isBGGroup() || group->isBFGroup())
{
group = GetPlayer()->GetOriginalGroup();
}
}
Group* group2 = player->GetGroup();
if (group2 && (group2->isBGGroup() || group2->isBFGroup()))
group2 = player->GetOriginalGroup();
Group* group2 = invitedPlayer->GetGroup();
if (group2 && group2->isBGGroup())
group2 = invitedPlayer->GetOriginalGroup();
// player already in another group or invited
if (group2 || player->GetGroupInvite())
if (group2 || invitedPlayer->GetGroupInvite())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S);
@@ -158,11 +149,11 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
// tell the player that they were invited but it failed as they were already in a group
WorldPacket data(SMSG_GROUP_INVITE, 25); // guess size
data << uint8(0); // invited/already in group flag
data << GetPlayer()->GetName(); // max len 48
data << invitingPlayer->GetName(); // max len 48
data << uint32(0); // unk
data << uint8(0); // count
data << uint32(0); // unk
player->GetSession()->SendPacket(&data);
invitedPlayer->GetSession()->SendPacket(&data);
}
return;
@@ -171,7 +162,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
if (group)
{
// not have permissions for invite
if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
if (!group->IsLeader(invitingPlayer->GetGUID()) && !group->IsAssistant(invitingPlayer->GetGUID()))
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_NOT_LEADER);
return;
@@ -185,22 +176,22 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
}
// xinef: if player has no group, check group invite
if (!group && GetPlayer()->GetGroupInvite() && GetPlayer()->GetGroupInvite()->GetLeaderGUID() == GetPlayer()->GetGUID())
group = GetPlayer()->GetGroupInvite();
if (!group && invitingPlayer->GetGroupInvite() && invitingPlayer->GetGroupInvite()->GetLeaderGUID() == invitingPlayer->GetGUID())
group = invitingPlayer->GetGroupInvite();
// ok, but group not exist, start a new group
// but don't create and save the group to the DB until
// at least one person joins
if (!group)
{
group = new Group;
group = new Group();
// new group: if can't add then delete
if (!group->AddLeaderInvite(GetPlayer()))
if (!group->AddLeaderInvite(invitingPlayer))
{
delete group;
return;
}
if (!group->AddInvite(player))
if (!group->AddInvite(invitedPlayer))
{
delete group;
return;
@@ -209,7 +200,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
else
{
// already existed group: if can't add then just leave
if (!group->AddInvite(player))
if (!group->AddInvite(invitedPlayer))
{
return;
}
@@ -218,19 +209,17 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
// ok, we do it
WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size
data << uint8(1); // invited/already in group flag
data << GetPlayer()->GetName(); // max len 48
data << invitingPlayer->GetName(); // max len 48
data << uint32(0); // unk
data << uint8(0); // count
data << uint32(0); // unk
player->GetSession()->SendPacket(&data);
invitedPlayer->GetSession()->SendPacket(&data);
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK);
}
void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_ACCEPT");
recvData.read_skip<uint32>();
Group* group = GetPlayer()->GetGroupInvite();
@@ -291,8 +280,6 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_DECLINE");
Group* group = GetPlayer()->GetGroupInvite();
if (!group)
return;
@@ -314,8 +301,6 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE_GUID");
ObjectGuid guid;
std::string reason, name;
recvData >> guid;
@@ -389,8 +374,6 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE");
std::string membername;
recvData >> membername;
@@ -436,8 +419,6 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_SET_LEADER");
ObjectGuid guid;
recvData >> guid;
@@ -457,10 +438,9 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recvData*/)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_DISBAND");
Group* grp = GetPlayer()->GetGroup();
if (!grp)
Group* grpInvite = GetPlayer()->GetGroupInvite();
if (!grp && !grpInvite)
return;
if (_player->InBattleground())
@@ -473,15 +453,20 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recvData*/)
/********************/
// everything's fine, do it
SendPartyResult(PARTY_OP_LEAVE, GetPlayer()->GetName(), ERR_PARTY_RESULT_OK);
GetPlayer()->RemoveFromGroup(GROUP_REMOVEMETHOD_LEAVE);
if (grp)
{
SendPartyResult(PARTY_OP_LEAVE, GetPlayer()->GetName(), ERR_PARTY_RESULT_OK);
GetPlayer()->RemoveFromGroup(GROUP_REMOVEMETHOD_LEAVE);
}
else if (grpInvite && grpInvite->GetLeaderGUID() == GetPlayer()->GetGUID())
{ // pending group creation being cancelled
SendPartyResult(PARTY_OP_LEAVE, GetPlayer()->GetName(), ERR_PARTY_RESULT_OK);
grpInvite->Disband();
}
}
void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_LOOT_METHOD");
uint32 lootMethod;
ObjectGuid lootMaster;
uint32 lootThreshold;
@@ -544,8 +529,6 @@ void WorldSession::HandleLootRoll(WorldPacket& recvData)
void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received MSG_MINIMAP_PING");
if (!GetPlayer()->GetGroup())
return;
@@ -581,8 +564,6 @@ void WorldSession::HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient&
void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received MSG_RAID_TARGET_UPDATE");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
@@ -620,8 +601,6 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket& /*recvData*/)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_RAID_CONVERT");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
@@ -647,8 +626,6 @@ void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP");
// we will get correct pointer for group here, so we don't have to check if group is BG raid
Group* group = GetPlayer()->GetGroup();
if (!group)
@@ -686,8 +663,6 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
@@ -707,8 +682,6 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received MSG_PARTY_ASSIGNMENT");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
@@ -741,8 +714,6 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received MSG_RAID_READY_CHECK");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
@@ -986,7 +957,6 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
ObjectGuid Guid;
recvData >> Guid;
@@ -1127,8 +1097,6 @@ void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_OPT_OUT_OF_LOOT");
uint32 passOnLoot;
recvData >> passOnLoot; // 1 always pass, 0 do not pass

View File

@@ -727,7 +727,6 @@ void WorldSession::HandleReadItem(WorldPacket& recvData)
void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM");
ObjectGuid vendorguid, itemguid;
uint32 count;
@@ -908,7 +907,6 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
void WorldSession::HandleBuybackItem(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM");
ObjectGuid vendorguid;
uint32 slot;
@@ -964,7 +962,6 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
ObjectGuid vendorguid, bagguid;
uint32 item, slot, count;
uint8 bagslot;
@@ -1006,7 +1003,6 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM");
ObjectGuid vendorguid;
uint32 item, slot, count;
uint8 unk1;

View File

@@ -29,6 +29,7 @@
#include "GossipDef.h"
#include "Group.h"
#include "GuildMgr.h"
#include "InstanceScript.h"
#include "Language.h"
#include "Log.h"
#include "LootMgr.h"
@@ -69,7 +70,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
// creatures can kill players
// so if the server is lagging enough the player can
// release spirit after he's killed but before he is updated
if (GetPlayer()->getDeathState() == JUST_DIED)
if (GetPlayer()->getDeathState() == DeathState::JustDied)
{
LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player {} ({}) was killed and before he was updated",
GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString());
@@ -622,14 +623,6 @@ void WorldSession::HandleBugOpcode(WorldPacket& recv_data)
recv_data >> typelen >> type;
if (suggestion == 0)
LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Bug Report]");
else
LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Suggestion]");
LOG_DEBUG("network", "{}", type);
LOG_DEBUG("network", "{}", content);
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_BUG_REPORT);
stmt->SetData(0, type);
@@ -640,8 +633,6 @@ void WorldSession::HandleBugOpcode(WorldPacket& recv_data)
void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
{
LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE");
ObjectGuid guid;
recv_data >> guid;
@@ -676,8 +667,6 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
{
LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE");
ObjectGuid guid;
uint8 status;
recv_data >> guid;
@@ -857,8 +846,6 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data)
{
LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA");
uint32 type, timestamp, decompressedSize;
recv_data >> type >> timestamp >> decompressedSize;
@@ -912,8 +899,6 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data)
void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
{
LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA");
uint32 type;
recv_data >> type;
@@ -950,7 +935,6 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
{
LOG_DEBUG("network", "WORLD: Received CMSG_SET_ACTION_BUTTON");
uint8 button;
uint32 packetData;
recv_data >> button >> packetData;
@@ -992,26 +976,18 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
void WorldSession::HandleCompleteCinematic(WorldPacket& /*recv_data*/)
{
{
LOG_DEBUG("network", "WORLD: Received CMSG_COMPLETE_CINEMATIC");
}
// If player has sight bound to visual waypoint NPC we should remove it
GetPlayer()->GetCinematicMgr()->EndCinematic();
}
void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recv_data*/)
{
{
LOG_DEBUG("network", "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA");
}
// Sent by client when cinematic actually begun. So we begin the server side process
GetPlayer()->GetCinematicMgr()->BeginCinematic();
}
void WorldSession::HandleFeatherFallAck(WorldPacket& recv_data)
{
LOG_DEBUG("network", "WORLD: CMSG_MOVE_FEATHER_FALL_ACK");
// no used
recv_data.rfinish(); // prevent warnings spam
}
@@ -1046,8 +1022,6 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
ObjectGuid guid;
recv_data >> guid;
LOG_DEBUG("network", "WORLD: Received CMSG_INSPECT");
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
if (!player)
{
@@ -1133,8 +1107,6 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
recv_data >> PositionZ;
recv_data >> Orientation; // o (3.141593 = 180 degrees)
LOG_DEBUG("network", "WORLD: Received CMSG_WORLD_TELEPORT");
if (GetPlayer()->IsInFlight())
{
LOG_DEBUG("network", "Player '{}' ({}) in flight, ignore worldport command.", GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString());
@@ -1146,7 +1118,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
if (AccountMgr::IsAdminAccount(GetSecurity()))
GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation);
else
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
SendNotification(LANG_PERMISSION_DENIED);
}
void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
@@ -1157,7 +1129,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
if (!AccountMgr::IsAdminAccount(GetSecurity()))
{
SendNotification(LANG_YOU_NOT_HAVE_PERMISSION);
SendNotification(LANG_PERMISSION_DENIED);
return;
}
@@ -1454,7 +1426,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recv_data)
return;
}
if (IsSharedDifficultyMap(groupGuy->GetMap()->GetId()) && (_player->GetRaidDifficulty() >= 0 && uint32(mode % 2) == uint32(_player->GetRaidDifficulty() % 2)) && group->isRaidGroup())
if (IsSharedDifficultyMap(groupGuy->GetMap()->GetId()) && (uint32(mode % 2) == uint32(_player->GetRaidDifficulty() % 2)) && group->isRaidGroup())
{
if (!currMap)
currMap = groupGuy->GetMap();

View File

@@ -49,20 +49,19 @@ void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket& /*recvData*/)
void WorldSession::HandleMoveWorldportAck()
{
Player* player = GetPlayer();
// ignore unexpected far teleports
if (!player->IsBeingTeleportedFar())
if (!GetPlayer()->IsBeingTeleportedFar())
return;
player->SetSemaphoreTeleportFar(0);
GetPlayer()->SetSemaphoreTeleportFar(0);
// get the teleport destination
WorldLocation const& loc = player->GetTeleportDest();
WorldLocation const& loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if (!MapMgr::IsValidMapCoord(loc))
{
LogoutPlayer(false);
KickPlayer("!MapMgr::IsValidMapCoord(loc)");
return;
}
@@ -70,202 +69,198 @@ void WorldSession::HandleMoveWorldportAck()
MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId());
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(loc.GetMapId());
Map* oldMap = player->GetMap();
if (player->IsInWorld())
Map* oldMap = GetPlayer()->GetMap();
if (GetPlayer()->IsInWorld())
{
LOG_ERROR("network.opcode", "Player (Name {}) is still in world when teleported from map {} to new map {}", player->GetName(), oldMap->GetId(), loc.GetMapId());
oldMap->RemovePlayerFromMap(player, false);
LOG_ERROR("network.opcode", "Player (Name {}) is still in world when teleported from map {} to new map {}", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId());
oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
// reset instance validity, except if going to an instance inside an instance
if (!player->m_InstanceValid && !mInstance)
if (!GetPlayer()->m_InstanceValid && !mInstance)
{
player->m_InstanceValid = true;
GetPlayer()->m_InstanceValid = true;
// pussywizard: m_InstanceValid can be false only by leaving a group in an instance => so remove temp binds that could not be removed because player was still on the map!
if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(player->GetGUID(), oldMap->GetId(), oldMap->GetDifficulty()))
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), oldMap->GetId(), oldMap->GetDifficulty(), true);
if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(GetPlayer()->GetGUID(), oldMap->GetId(), oldMap->GetDifficulty()))
sInstanceSaveMgr->PlayerUnbindInstance(GetPlayer()->GetGUID(), oldMap->GetId(), oldMap->GetDifficulty(), true);
}
// relocate the player to the teleport destination
Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), player);
Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer());
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if (!newMap || newMap->CannotEnter(player, false))
if (!newMap || newMap->CannotEnter(GetPlayer(), false))
{
LOG_ERROR("network.opcode", "Map {} could not be created for player {}, porting player to homebind", loc.GetMapId(), player->GetGUID().ToString());
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->m_homebindO);
LOG_ERROR("network.opcode", "Map {} could not be created for player {}, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUID().ToString());
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->m_homebindO);
return;
}
float z = loc.GetPositionZ() + player->GetHoverHeight();
player->Relocate(loc.GetPositionX(), loc.GetPositionY(), z, loc.GetOrientation());
float z = loc.GetPositionZ() + GetPlayer()->GetHoverHeight();
GetPlayer()->Relocate(loc.GetPositionX(), loc.GetPositionY(), z, loc.GetOrientation());
player->ResetMap();
player->SetMap(newMap);
GetPlayer()->ResetMap();
GetPlayer()->SetMap(newMap);
player->UpdatePositionData();
GetPlayer()->UpdatePositionData();
player->SendInitialPacketsBeforeAddToMap();
if (!player->GetMap()->AddPlayerToMap(player))
GetPlayer()->SendInitialPacketsBeforeAddToMap();
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
{
LOG_ERROR("network.opcode", "WORLD: failed to teleport player {} ({}) to map {} because of unknown reason!",
player->GetName(), player->GetGUID().ToString(), loc.GetMapId());
player->ResetMap();
player->SetMap(oldMap);
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->m_homebindO);
GetPlayer()->GetName(), GetPlayer()->GetGUID().ToString(), loc.GetMapId());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(oldMap);
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->m_homebindO);
return;
}
oldMap->AfterPlayerUnlinkFromMap();
// pussywizard: transport teleport couldn't teleport us to the same map (some other teleport pending, reqs not met, etc.), but we still have transport set until player moves! clear it if map differs (crashfix)
if (Transport* t = player->GetTransport())
if (!t->IsInMap(player))
if (Transport* t = _player->GetTransport())
if (!t->IsInMap(_player))
{
t->RemovePassenger(player);
player->m_transport = nullptr;
player->m_movementInfo.transport.Reset();
player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
t->RemovePassenger(_player);
_player->m_transport = nullptr;
_player->m_movementInfo.transport.Reset();
_player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}
if (!player->getHostileRefMgr().IsEmpty())
player->getHostileRefMgr().deleteReferences(true); // pussywizard: multithreading crashfix
if (!_player->getHostileRefMgr().IsEmpty())
_player->getHostileRefMgr().deleteReferences(true); // pussywizard: multithreading crashfix
CellCoord pair(Acore::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
CellCoord pair(Acore::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()));
Cell cell(pair);
if (!GridCoord(cell.GridX(), cell.GridY()).IsCoordValid())
{
LogoutPlayer(false);
KickPlayer("!GridCoord(cell.GridX(), cell.GridY()).IsCoordValid()");
return;
}
if (!newMap->IsGridLoaded(player->GetPositionX(), player->GetPositionY()))
newMap->LoadGrid(player->GetPositionX(), player->GetPositionY());
newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY());
// pussywizard: player supposed to enter bg map
if (player->InBattleground())
if (_player->InBattleground())
{
// but landed on another map, cleanup data
if (!mEntry->IsBattlegroundOrArena())
player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
// everything ok
else if (Battleground* bg = player->GetBattleground())
else if (Battleground* bg = _player->GetBattleground())
{
if (player->IsInvitedForBattlegroundInstance()) // GMs are not invited, so they are not added to participants
bg->AddPlayer(player);
if (_player->IsInvitedForBattlegroundInstance()) // GMs are not invited, so they are not added to participants
bg->AddPlayer(_player);
}
}
// pussywizard: arena spectator stuff
{
if (newMap->IsBattleArena() && ((BattlegroundMap*)newMap)->GetBG() && player->HasPendingSpectatorForBG(((BattlegroundMap*)newMap)->GetInstanceId()))
if (newMap->IsBattleArena() && ((BattlegroundMap*)newMap)->GetBG() && _player->HasPendingSpectatorForBG(((BattlegroundMap*)newMap)->GetInstanceId()))
{
player->ClearReceivedSpectatorResetFor();
player->SetIsSpectator(true);
ArenaSpectator::SendCommand(player, "%sENABLE", SPECTATOR_ADDON_PREFIX);
((BattlegroundMap*)newMap)->GetBG()->AddSpectator(player);
ArenaSpectator::HandleResetCommand(player);
_player->ClearReceivedSpectatorResetFor();
_player->SetIsSpectator(true);
ArenaSpectator::SendCommand(_player, "%sENABLE", SPECTATOR_ADDON_PREFIX);
((BattlegroundMap*)newMap)->GetBG()->AddSpectator(_player);
ArenaSpectator::HandleResetCommand(_player);
}
else
player->SetIsSpectator(false);
_player->SetIsSpectator(false);
player->SetPendingSpectatorForBG(0);
GetPlayer()->SetPendingSpectatorForBG(0);
if (uint32 inviteInstanceId = player->GetPendingSpectatorInviteInstanceId())
if (uint32 inviteInstanceId = _player->GetPendingSpectatorInviteInstanceId())
{
if (Battleground* tbg = sBattlegroundMgr->GetBattleground(inviteInstanceId, BATTLEGROUND_TYPE_NONE))
tbg->RemoveToBeTeleported(player->GetGUID());
player->SetPendingSpectatorInviteInstanceId(0);
tbg->RemoveToBeTeleported(_player->GetGUID());
_player->SetPendingSpectatorInviteInstanceId(0);
}
}
// xinef: do this again, player can be teleported inside bg->AddPlayer(player)!!!!
CellCoord pair2(Acore::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
// xinef: do this again, player can be teleported inside bg->AddPlayer(_player)!!!!
CellCoord pair2(Acore::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()));
Cell cell2(pair2);
if (!GridCoord(cell2.GridX(), cell2.GridY()).IsCoordValid())
{
KickPlayer("!GridCoord(cell2.GridX(), cell2.GridY()).IsCoordValid()");
return;
}
newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY());
if (!newMap->IsGridLoaded(player->GetPositionX(), player->GetPositionY()))
newMap->LoadGrid(player->GetPositionX(), player->GetPositionY());
player->SendInitialPacketsAfterAddToMap();
GetPlayer()->SendInitialPacketsAfterAddToMap();
// flight fast teleport case
if (player->IsInFlight())
if (GetPlayer()->IsInFlight())
{
if (!player->InBattleground())
if (!GetPlayer()->InBattleground())
{
// short preparations to continue flight
MovementGenerator* movementGenerator = player->GetMotionMaster()->top();
movementGenerator->Initialize(player);
MovementGenerator* movementGenerator = GetPlayer()->GetMotionMaster()->top();
movementGenerator->Initialize(GetPlayer());
return;
}
// battleground state prepare, stop flight
player->GetMotionMaster()->MovementExpired();
player->CleanupAfterTaxiFlight();
GetPlayer()->GetMotionMaster()->MovementExpired();
GetPlayer()->CleanupAfterTaxiFlight();
}
// resurrect character at enter into instance where his corpse exist after add to map
Corpse* corpse = player->GetMap()->GetCorpseByPlayer(player->GetGUID());
Corpse* corpse = GetPlayer()->GetMap()->GetCorpseByPlayer(GetPlayer()->GetGUID());
if (corpse && corpse->GetType() != CORPSE_BONES)
{
if (mEntry->IsDungeon())
{
player->ResurrectPlayer(0.5f);
player->SpawnCorpseBones();
GetPlayer()->ResurrectPlayer(0.5f);
GetPlayer()->SpawnCorpseBones();
}
}
if (!corpse && mEntry->IsDungeon())
{
// resurrect character upon entering instance when the corpse is not available anymore
if (player->GetCorpseLocation().GetMapId() == mEntry->MapID)
if (GetPlayer()->GetCorpseLocation().GetMapId() == mEntry->MapID)
{
player->ResurrectPlayer(0.5f);
player->RemoveCorpse();
GetPlayer()->ResurrectPlayer(0.5f);
GetPlayer()->RemoveCorpse();
}
}
bool allowMount = !mEntry->IsDungeon() || mEntry->IsBattlegroundOrArena();
if (mInstance)
{
Difficulty diff = player->GetDifficulty(mEntry->IsRaid());
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID, diff))
if (mapDiff->resetTime)
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff))
{
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime().count());
player->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true);
GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true);
}
allowMount = mInstance->AllowMount;
}
// mount allow check
if (!allowMount)
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
_player->RemoveAurasByType(SPELL_AURA_MOUNTED);
// update zone immediately, otherwise leave channel will cause crash in mtmap
uint32 newzone, newarea;
player->GetZoneAndAreaId(newzone, newarea);
player->UpdateZone(newzone, newarea);
GetPlayer()->GetZoneAndAreaId(newzone, newarea);
GetPlayer()->UpdateZone(newzone, newarea);
// honorless target
if (player->pvpInfo.IsHostile)
player->CastSpell(player, 2479, true);
if (GetPlayer()->pvpInfo.IsHostile)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
// in friendly area
else if (player->IsPvP() && !player->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
player->UpdatePvP(false, false);
else if (GetPlayer()->IsPvP() && !GetPlayer()->HasPlayerFlag(PLAYER_FLAGS_IN_PVP))
GetPlayer()->UpdatePvP(false, false);
// resummon pet
player->ResummonPetTemporaryUnSummonedIfAny();
GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
//lets process all delayed operations on successful teleport
player->ProcessDelayedOperations();
GetPlayer()->ProcessDelayedOperations();
}
void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
@@ -388,7 +383,6 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
if (plrMover)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(plrMover, true);
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
}
@@ -410,7 +404,6 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
if (plrMover)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(plrMover, true);
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
}
return;
@@ -432,7 +425,6 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
if (plrMover)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(plrMover, true);
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
//LOG_INFO("anticheat", "MovementHandler:: 2 We were teleported, skip packets that were broadcast before teleport");
}
@@ -445,7 +437,6 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
{
if (plrMover)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(plrMover, true);
sScriptMgr->AnticheatUpdateMovementInfo(plrMover, movementInfo);
}
@@ -466,8 +457,6 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
}
else if (plrMover->GetTransport()->GetGUID() != movementInfo.transport.guid)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(plrMover, true);
bool foundNewTransport = false;
plrMover->m_transport->RemovePassenger(plrMover);
if (Transport* transport = plrMover->GetMap()->GetTransport(movementInfo.transport.guid))

View File

@@ -215,7 +215,6 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
uint32 spellId = 0;
recvData >> guid >> spellId;
LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL Npc {}, learn spell id is: {}", guid.ToString(), spellId);
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
if (!unit)
@@ -273,8 +272,6 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO");
ObjectGuid guid;
recvData >> guid;

View File

@@ -301,7 +301,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
GetPlayer()->RemovePet(pet->ToPet(), PET_SAVE_AS_DELETED);
else
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
pet->setDeathState(CORPSE);
pet->setDeathState(DeathState::Corpse);
}
else if (pet->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_SUMMON | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN))
{

View File

@@ -219,8 +219,6 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
{
LOG_DEBUG("network", "WORLD: Received MSG_CORPSE_QUERY");
if (!_player->HasCorpse())
{
WorldPacket data(MSG_CORPSE_QUERY, 1);
@@ -356,8 +354,6 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
/// Only _static_ data is sent in this packet !!!
void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_PAGE_TEXT_QUERY");
uint32 pageID;
recvData >> pageID;
recvData.read_skip<uint64>(); // guid

View File

@@ -380,8 +380,6 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData)
void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recvData*/)
{
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CANCEL");
_player->PlayerTalkClass->SendCloseGossip();
}
@@ -535,7 +533,6 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/)
{
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH");
}
void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
@@ -624,8 +621,6 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
uint8 msg;
recvPacket >> guid >> questId >> msg;
LOG_DEBUG("network", "WORLD: Received MSG_QUEST_PUSH_RESULT");
if (_player->GetDivider() && _player->GetDivider() == guid)
{
if (Player* player = ObjectAccessor::GetPlayer(*_player, _player->GetDivider()))
@@ -641,9 +636,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/)
{
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY");
_player->SendQuestGiverStatusMultiple();
_player->SendQuestGiverStatusMultiple();
}
void WorldSession::HandleQueryQuestsCompleted(WorldPacket& /*recvData*/)

View File

@@ -31,15 +31,11 @@ void WorldSession::HandleContactListOpcode(WorldPacket& recv_data)
uint32 flags;
recv_data >> flags;
LOG_DEBUG("network", "WORLD: Received CMSG_CONTACT_LIST - Unk: {}", flags);
_player->GetSocial()->SendSocialList(_player, flags);
}
void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
{
LOG_DEBUG("network", "WORLD: Received CMSG_ADD_FRIEND");
std::string friendName = GetAcoreString(LANG_FRIEND_IGNORE_UNKNOWN);
std::string friendNote;
@@ -49,8 +45,6 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
if (!normalizePlayerName(friendName))
return;
LOG_DEBUG("network", "WORLD: {} asked to add friend : '{}'", GetPlayer()->GetName(), friendName);
ObjectGuid friendGuid = sCharacterCache->GetCharacterGuidByName(friendName);
if (!friendGuid)
return;
@@ -76,7 +70,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
else
{
Player* pFriend = ObjectAccessor::FindConnectedPlayer(friendGuid);
if (pFriend && pFriend->IsVisibleGloballyFor(GetPlayer()) && !AccountMgr::IsGMAccount(pFriend->GetSession()->GetSecurity()))
if (pFriend && pFriend->IsVisibleGloballyFor(GetPlayer()) && !pFriend->GetSession()->IsGMAccount())
friendResult = FRIEND_ADDED_ONLINE;
else
friendResult = FRIEND_ADDED_OFFLINE;

View File

@@ -27,8 +27,6 @@
void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
ObjectGuid guid;
recvData >> guid;
@@ -61,8 +59,6 @@ void WorldSession::SendTaxiStatus(ObjectGuid guid)
void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
ObjectGuid guid;
recvData >> guid;
@@ -124,13 +120,9 @@ void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathN
GetPlayer()->Mount(mountDisplayId);
if (Creature* critter = ObjectAccessor::GetCreature(*GetPlayer(), GetPlayer()->GetCritterGUID()))
{
critter->DespawnOrUnsummon();
}
GetPlayer()->GetMotionMaster()->MoveTaxiFlight(path, pathNode);
sScriptMgr->AnticheatSetSkipOnePacketForASH(GetPlayer(), true);
}
bool WorldSession::SendLearnNewTaxiNode(Creature* unit)
@@ -168,8 +160,6 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
ObjectGuid guid;
uint32 node_count;
@@ -209,8 +199,6 @@ void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData)
void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_SPLINE_DONE");
ObjectGuid guid; // used only for proper packet read
recvData >> guid.ReadAsPacked();
@@ -263,8 +251,6 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI");
ObjectGuid guid;
std::vector<uint32> nodes;
nodes.resize(2);

View File

@@ -339,10 +339,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 my_spell_id = my_trade->GetSpell())
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(my_spell_id);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(my_spell_id);
Item* castItem = my_trade->GetSpellCastItem();
if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
if (!spellInfo || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
(my_trade->HasSpellCastItem() && !castItem))
{
clearAcceptTradeMode(my_trade, his_trade);
@@ -352,7 +352,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
return;
}
my_spell = new Spell(_player, spellEntry, TRIGGERED_FULL_MASK);
my_spell = new Spell(_player, spellInfo, TRIGGERED_FULL_MASK);
my_spell->m_CastItem = castItem;
my_targets.SetTradeItemTarget(_player);
my_spell->m_targets = my_targets;
@@ -374,10 +374,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 his_spell_id = his_trade->GetSpell())
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(his_spell_id);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(his_spell_id);
Item* castItem = his_trade->GetSpellCastItem();
if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
if (!spellInfo || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
{
delete my_spell;
his_trade->SetSpell(0);
@@ -387,7 +387,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
return;
}
his_spell = new Spell(trader, spellEntry, TRIGGERED_FULL_MASK);
his_spell = new Spell(trader, spellInfo, TRIGGERED_FULL_MASK);
his_spell->m_CastItem = castItem;
his_targets.SetTradeItemTarget(trader);
his_spell->m_targets = his_targets;