mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 15:46:24 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -47,7 +47,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
|
||||
|
||||
AddOnPacked.resize(AddonRealSize); // resize target for zlib action
|
||||
|
||||
if (uncompress(const_cast<uint8*>(AddOnPacked.contents()), &AddonRealSize, const_cast<uint8*>((*Source).contents() + CurrentPosition), (*Source).size() - CurrentPosition)== Z_OK)
|
||||
if (uncompress(const_cast<uint8*>(AddOnPacked.contents()), &AddonRealSize, const_cast<uint8*>((*Source).contents() + CurrentPosition), (*Source).size() - CurrentPosition) == Z_OK)
|
||||
{
|
||||
Target->Initialize(SMSG_ADDON_INFO);
|
||||
|
||||
@@ -61,13 +61,13 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
|
||||
uint32 crc, unk2;
|
||||
|
||||
// check next addon data format correctness
|
||||
if (AddOnPacked.rpos()+1 > AddOnPacked.size())
|
||||
if (AddOnPacked.rpos() + 1 > AddOnPacked.size())
|
||||
return false;
|
||||
|
||||
AddOnPacked >> addonName;
|
||||
|
||||
// recheck next addon data format correctness
|
||||
if (AddOnPacked.rpos()+1+4+4 > AddOnPacked.size())
|
||||
if (AddOnPacked.rpos() + 1 + 4 + 4 > AddOnPacked.size())
|
||||
return false;
|
||||
|
||||
AddOnPacked >> enabled >> crc >> unk2;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
~AddonHandler();
|
||||
|
||||
static AddonHandler* instance();
|
||||
|
||||
|
||||
//build addon packet
|
||||
bool BuildAddonPacket(WorldPacket* Source, WorldPacket* Target);
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "Opcodes.h"
|
||||
|
||||
void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_ARENA_TEAMS");
|
||||
@@ -42,7 +42,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_QUERY");
|
||||
@@ -58,7 +58,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_ROSTER");
|
||||
@@ -71,7 +71,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recvData)
|
||||
arenaTeam->Roster(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_INVITE");
|
||||
@@ -151,7 +151,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
|
||||
|
||||
player->SetArenaTeamIdInvited(arenaTeam->GetId());
|
||||
|
||||
WorldPacket data(SMSG_ARENA_TEAM_INVITE, (8+10));
|
||||
WorldPacket data(SMSG_ARENA_TEAM_INVITE, (8 + 10));
|
||||
data << GetPlayer()->GetName();
|
||||
data << arenaTeam->GetName();
|
||||
player->GetSession()->SendPacket(&data);
|
||||
@@ -161,7 +161,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_ACCEPT"); // empty opcode
|
||||
@@ -196,7 +196,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/)
|
||||
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_JOIN_SS, _player->GetGUID(), 2, _player->GetName().c_str(), arenaTeam->GetName(), "");
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DECLINE"); // empty opcode
|
||||
@@ -206,7 +206,7 @@ void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recvData*/)
|
||||
_player->SetArenaTeamIdInvited(0);
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE");
|
||||
@@ -250,7 +250,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket & recvData)
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, arenaTeam->GetName(), "", 0);
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DISBAND");
|
||||
@@ -274,7 +274,7 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_REMOVE");
|
||||
@@ -326,7 +326,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recvData)
|
||||
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER");
|
||||
@@ -373,7 +373,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recvData)
|
||||
|
||||
void WorldSession::SendArenaTeamCommandResult(uint32 teamAction, const std::string& team, const std::string& player, uint32 errorId)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+team.length()+1+player.length()+1+4);
|
||||
WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4 + team.length() + 1 + player.length() + 1 + 4);
|
||||
data << uint32(teamAction);
|
||||
data << team;
|
||||
data << player;
|
||||
@@ -383,7 +383,7 @@ void WorldSession::SendArenaTeamCommandResult(uint32 teamAction, const std::stri
|
||||
|
||||
void WorldSession::SendNotInArenaTeamPacket(uint8 type)
|
||||
{
|
||||
WorldPacket data(SMSG_ARENA_ERROR, 4+1); // 886 - You are not in a %uv%u arena team
|
||||
WorldPacket data(SMSG_ARENA_ERROR, 4 + 1); // 886 - You are not in a %uv%u arena team
|
||||
uint32 unk = 0;
|
||||
data << uint32(unk); // unk(0)
|
||||
if (!unk)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "AsyncAuctionListing.h"
|
||||
|
||||
//void called when player click on auctioneer npc
|
||||
void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid; //NPC guid
|
||||
recvData >> guid;
|
||||
@@ -77,7 +77,7 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin
|
||||
//this function sends notification, if bidder is online
|
||||
void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
|
||||
{
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8 * 4));
|
||||
data << uint32(location);
|
||||
data << uint32(auctionId);
|
||||
data << uint64(bidder);
|
||||
@@ -91,7 +91,7 @@ void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auction
|
||||
//this void causes on client to display: "Your auction sold"
|
||||
void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
|
||||
{
|
||||
WorldPacket data(SMSG_AUCTION_OWNER_NOTIFICATION, (8*4));
|
||||
WorldPacket data(SMSG_AUCTION_OWNER_NOTIFICATION, (8 * 4));
|
||||
data << uint32(auction->Id);
|
||||
data << uint32(auction->bid);
|
||||
data << uint32(0); //unk
|
||||
@@ -103,7 +103,7 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
|
||||
}
|
||||
|
||||
//this void creates new auction and adds auction to some auctionhouse
|
||||
void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
{
|
||||
uint64 auctioneer;
|
||||
uint32 itemsCount, etime, bid, buyout;
|
||||
@@ -202,8 +202,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
||||
itemEntry = item->GetTemplate()->ItemId;
|
||||
|
||||
if (sAuctionMgr->GetAItem(item->GetGUIDLow()) || !item->CanBeTraded() || item->IsNotEmptyBag() ||
|
||||
item->GetTemplate()->Flags & ITEM_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
|
||||
item->GetCount() < count[i] || itemEntry != item->GetTemplate()->ItemId)
|
||||
item->GetTemplate()->Flags & ITEM_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
|
||||
item->GetCount() < count[i] || itemEntry != item->GetTemplate()->ItemId)
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
return;
|
||||
@@ -373,7 +373,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//this function is called when client bids or buys out auction
|
||||
void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_PLACE_BID");
|
||||
@@ -428,7 +428,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
|
||||
|
||||
// price too low for next bid if not buyout
|
||||
if ((price < auction->buyout || auction->buyout == 0) &&
|
||||
price < auction->bid + auction->GetAuctionOutBid())
|
||||
price < auction->bid + auction->GetAuctionOutBid())
|
||||
{
|
||||
//auction has already higher bid, client tests it!
|
||||
return;
|
||||
@@ -503,7 +503,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//this void is called when auction_owner cancels his auction
|
||||
void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
|
||||
@@ -551,8 +551,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
|
||||
|
||||
// item will deleted or added to received mail list
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -583,7 +583,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//called when player lists his bids
|
||||
void WorldSession::HandleAuctionListBidderItems(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
|
||||
@@ -618,7 +618,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recvData)
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4)+30000); // pussywizard: ensure there is enough memory
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4 + 4 + 4) + 30000); // pussywizard: ensure there is enough memory
|
||||
Player* player = GetPlayer();
|
||||
data << (uint32) 0; //add 0 as count
|
||||
uint32 count = 0;
|
||||
@@ -644,7 +644,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//this void sends player info about his auctions
|
||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
|
||||
{
|
||||
// prevent crash caused by malformed packet
|
||||
uint64 guid;
|
||||
@@ -663,7 +663,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
|
||||
diff = delay;
|
||||
|
||||
_lastAuctionListOwnerItemsMSTime = now + delay; // set longest possible here, actual exectuing will change this to getMSTime of that moment
|
||||
_player->m_Events.AddEvent(new AuctionListOwnerItemsDelayEvent(guid, _player->GetGUID(), true), _player->m_Events.CalculateTime(delay-diff));
|
||||
_player->m_Events.AddEvent(new AuctionListOwnerItemsDelayEvent(guid, _player->GetGUID(), true), _player->m_Events.CalculateTime(delay - diff));
|
||||
}
|
||||
|
||||
|
||||
@@ -690,7 +690,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid)
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4+4+4)+60000); // pussywizard: ensure there is enough memory
|
||||
WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4 + 4 + 4) + 60000); // pussywizard: ensure there is enough memory
|
||||
data << (uint32) 0; // amount place holder
|
||||
|
||||
uint32 count = 0;
|
||||
@@ -704,7 +704,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid)
|
||||
}
|
||||
|
||||
//this void is called when player clicks on search button
|
||||
void WorldSession::HandleAuctionListItems(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_ITEMS");
|
||||
@@ -748,10 +748,10 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recvData)
|
||||
diff = delay;
|
||||
_lastAuctionListItemsMSTime = now + delay - diff;
|
||||
ACORE_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetTempLock());
|
||||
AsyncAuctionListingMgr::GetTempList().push_back( AuctionListItemsDelayEvent(delay-diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, getAll) );
|
||||
AsyncAuctionListingMgr::GetTempList().push_back( AuctionListItemsDelayEvent(delay - diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, getAll) );
|
||||
}
|
||||
|
||||
void WorldSession::HandleAuctionListPendingSales(WorldPacket & recvData)
|
||||
void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES");
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "Group.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid;
|
||||
@@ -60,7 +60,7 @@ void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
uint32 bgTypeId_;
|
||||
@@ -182,7 +182,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
|
||||
SendPacket(&data);
|
||||
|
||||
sScriptMgr->OnPlayerJoinBG(_player);
|
||||
|
||||
|
||||
}
|
||||
// check if group can queue:
|
||||
else
|
||||
@@ -194,11 +194,11 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recvData)
|
||||
|
||||
// pussywizard: for party members - remove queues for which leader is not queued to!
|
||||
std::set<uint32> leaderQueueTypeIds;
|
||||
for (uint32 i=0; i<PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
leaderQueueTypeIds.insert((uint32)_player->GetBattlegroundQueueTypeId(i));
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
if (Player* member = itr->GetSource())
|
||||
for (uint32 i=0; i<PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (BattlegroundQueueTypeId mqtid = member->GetBattlegroundQueueTypeId(i))
|
||||
if (leaderQueueTypeIds.count((uint32)mqtid) == 0)
|
||||
{
|
||||
@@ -319,7 +319,7 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandlePVPLogDataOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_PVP_LOG_DATA Message");
|
||||
@@ -342,7 +342,7 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recvData*/)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recvData)
|
||||
void WorldSession::HandleBattlefieldListOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message");
|
||||
@@ -366,7 +366,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
|
||||
void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint8 arenaType; // arenatype if arena
|
||||
uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||
@@ -384,7 +384,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
|
||||
if (!_player->InBattlegroundQueue())
|
||||
return;
|
||||
|
||||
// get BattlegroundQueue for received
|
||||
// get BattlegroundQueue for received
|
||||
BattlegroundTypeId bgTypeId = BattlegroundTypeId(bgTypeId_);
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(bgTypeId, arenaType);
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
@@ -473,7 +473,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
|
||||
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
// track if player refuses to join the BG after being invited
|
||||
if (bg->isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS) &&
|
||||
(bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
(bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
@@ -507,7 +507,7 @@ void WorldSession::HandleBattlefieldLeaveOpcode(WorldPacket& recvData)
|
||||
_player->LeaveBattleground();
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
// requested at login and on map change
|
||||
// send status for current queues and current bg
|
||||
@@ -568,7 +568,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
|
||||
void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid; // arena Battlemaster guid
|
||||
uint8 arenaslot; // 2v2, 3v3 or 5v5
|
||||
@@ -693,11 +693,11 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
|
||||
|
||||
// pussywizard: for party members - remove queues for which leader is not queued to!
|
||||
std::set<uint32> leaderQueueTypeIds;
|
||||
for (uint32 i=0; i<PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
leaderQueueTypeIds.insert((uint32)_player->GetBattlegroundQueueTypeId(i));
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
if (Player* member = itr->GetSource())
|
||||
for (uint32 i=0; i<PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
if (BattlegroundQueueTypeId mqtid = member->GetBattlegroundQueueTypeId(i))
|
||||
if (leaderQueueTypeIds.count((uint32)mqtid) == 0)
|
||||
{
|
||||
@@ -786,7 +786,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleReportPvPAFK(WorldPacket & recvData)
|
||||
void WorldSession::HandleReportPvPAFK(WorldPacket& recvData)
|
||||
{
|
||||
uint64 playerGuid;
|
||||
recvData >> playerGuid;
|
||||
|
||||
@@ -97,7 +97,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
time_t resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
dataBuffer << uint32(save->GetMapId());
|
||||
dataBuffer << uint32(save->GetDifficulty());
|
||||
dataBuffer << uint32(resetTime >= currTime ? resetTime-currTime : 0);
|
||||
dataBuffer << uint32(resetTime >= currTime ? resetTime - currTime : 0);
|
||||
dataBuffer << uint64(MAKE_NEW_GUID(save->GetInstanceId(), 0, HIGHGUID_INSTANCE)); // instance save id as unique instance copy id
|
||||
++boundCounter;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
|
||||
recvData >> eventId;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_EVENT. Player ["
|
||||
UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId);
|
||||
UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET);
|
||||
@@ -290,7 +290,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
||||
SetCalendarEventCreationCooldown(time(nullptr) + CALENDAR_CREATE_EVENT_COOLDOWN);
|
||||
|
||||
CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
|
||||
time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
|
||||
time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
|
||||
|
||||
if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
|
||||
if (Player* creator = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
@@ -383,11 +383,11 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
|
||||
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
|
||||
"Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
|
||||
"Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(),
|
||||
description.c_str(), type, repetitionType, maxInvites, dungeonId,
|
||||
eventPackedTime, timeZoneTime, flags);
|
||||
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
|
||||
"Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
|
||||
"Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(),
|
||||
description.c_str(), type, repetitionType, maxInvites, dungeonId,
|
||||
eventPackedTime, timeZoneTime, flags);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -429,7 +429,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
|
||||
recvData >> eventId >> inviteId;
|
||||
recvData.ReadPackedTime(eventTime);
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD
|
||||
"] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime);
|
||||
"] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime);
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
@@ -634,8 +634,8 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
|
||||
|
||||
recvData >> eventId >> inviteId >> status;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD"] EventId ["
|
||||
UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId,
|
||||
inviteId, status);
|
||||
UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId,
|
||||
inviteId, status);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -674,9 +674,9 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
|
||||
recvData >> inviteId >> ownerInviteId >> eventId;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_REMOVE_INVITE ["
|
||||
UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId ["
|
||||
UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])",
|
||||
guid, eventId, ownerInviteId, invitee, inviteId);
|
||||
UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId ["
|
||||
UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])",
|
||||
guid, eventId, ownerInviteId, invitee, inviteId);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -704,8 +704,8 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
|
||||
recvData.readPackGUID(invitee);
|
||||
recvData >> eventId >> inviteId >> ownerInviteId >> status;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId ["
|
||||
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
|
||||
UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status);
|
||||
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
|
||||
UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -738,8 +738,8 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
|
||||
recvData.readPackGUID(invitee);
|
||||
recvData >> eventId >> inviteId >> ownerInviteId >> rank;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId ["
|
||||
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
|
||||
UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank);
|
||||
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
|
||||
UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -764,7 +764,7 @@ void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
|
||||
|
||||
recvData >> eventId >> complainGUID;
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId ["
|
||||
UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID);
|
||||
UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID);
|
||||
|
||||
// what to do with complains?
|
||||
}
|
||||
@@ -775,7 +775,7 @@ void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/)
|
||||
uint32 pending = sCalendarMgr->GetPlayerNumPending(guid);
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD
|
||||
"] Pending: %u", guid, pending);
|
||||
"] Pending: %u", guid, pending);
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
|
||||
data << uint32(pending);
|
||||
@@ -786,7 +786,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
|
||||
{
|
||||
uint32 mapId, difficulty;
|
||||
uint8 toggleExtendOn;
|
||||
recvData >> mapId >> difficulty>> toggleExtendOn;
|
||||
recvData >> mapId >> difficulty >> toggleExtendOn;
|
||||
|
||||
const MapEntry* entry = sMapStore.LookupEntry(mapId);
|
||||
if (!entry || !entry->IsRaid())
|
||||
@@ -824,7 +824,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
|
||||
|
||||
data << uint32(save->GetMapId());
|
||||
data << uint32(save->GetDifficulty());
|
||||
data << uint32(save->GetResetTime() >= currTime ? save->GetResetTime()-currTime : 0);
|
||||
data << uint32(save->GetResetTime() >= currTime ? save->GetResetTime() - currTime : 0);
|
||||
data << uint64(MAKE_NEW_GUID(save->GetInstanceId(), 0, HIGHGUID_INSTANCE));
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -838,7 +838,7 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save, bool
|
||||
data.AppendPackedTime(currTime);
|
||||
data << uint32(save->GetMapId());
|
||||
data << uint32(save->GetDifficulty());
|
||||
data << uint32(resetTimeOp >= currTime ? resetTimeOp-currTime : resetTimeOp); // pussywizard: old time in secs to reset
|
||||
data << uint32(resetTime >= currTime ? resetTime-currTime : 0); // pussywizard: new time in secs to reset
|
||||
data << uint32(resetTimeOp >= currTime ? resetTimeOp - currTime : resetTimeOp); // pussywizard: old time in secs to reset
|
||||
data << uint32(resetTime >= currTime ? resetTime - currTime : 0); // pussywizard: new time in secs to reset
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), unk);
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), unk);
|
||||
#endif
|
||||
if (channelName.empty())
|
||||
return;
|
||||
@@ -78,8 +78,8 @@ void WorldSession::HandleChannelList(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "%s %s Channel: %s",
|
||||
recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST",
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST",
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
#endif
|
||||
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId()))
|
||||
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
|
||||
@@ -93,7 +93,7 @@ void WorldSession::HandleChannelPassword(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), password.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), password.c_str());
|
||||
#endif
|
||||
if (password.length() > MAX_CHANNEL_PASS_STR)
|
||||
return;
|
||||
@@ -110,7 +110,7 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -127,7 +127,7 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_OWNER %s Channel: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
#endif
|
||||
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId()))
|
||||
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
|
||||
@@ -141,7 +141,7 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -158,7 +158,7 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -175,7 +175,7 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -192,7 +192,7 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -209,7 +209,7 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -226,7 +226,7 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -243,7 +243,7 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -260,7 +260,7 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str());
|
||||
#endif
|
||||
if (!normalizePlayerName(targetName))
|
||||
return;
|
||||
@@ -277,34 +277,34 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
#endif
|
||||
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId()))
|
||||
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
|
||||
channel->Announce(GetPlayer());
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket)
|
||||
void WorldSession::HandleChannelDisplayListQuery(WorldPacket& recvPacket)
|
||||
{
|
||||
// this should be OK because the 2 function _were_ the same
|
||||
HandleChannelList(recvPacket);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
|
||||
void WorldSession::HandleGetChannelMemberCount(WorldPacket& recvPacket)
|
||||
{
|
||||
std::string channelName;
|
||||
recvPacket >> channelName;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s",
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
GetPlayerInfo().c_str(), channelName.c_str());
|
||||
#endif
|
||||
if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId()))
|
||||
{
|
||||
if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer()))
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u",
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), channel->GetNumPlayers());
|
||||
GetPlayerInfo().c_str(), channelName.c_str(), channel->GetNumPlayers());
|
||||
|
||||
WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, channel->GetName().size() + 1 + 4);
|
||||
data << channel->GetName();
|
||||
@@ -315,7 +315,7 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket)
|
||||
void WorldSession::HandleSetChannelWatch(WorldPacket& recvPacket)
|
||||
{
|
||||
std::string channelName;
|
||||
recvPacket >> channelName;
|
||||
@@ -330,7 +330,7 @@ void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket)
|
||||
channel->AddWatching(GetPlayer());
|
||||
}
|
||||
|
||||
void WorldSession::HandleClearChannelWatch(WorldPacket &recvPacket)
|
||||
void WorldSession::HandleClearChannelWatch(WorldPacket& recvPacket)
|
||||
{
|
||||
std::string channelName;
|
||||
recvPacket >> channelName;
|
||||
|
||||
@@ -45,15 +45,15 @@
|
||||
|
||||
class LoginQueryHolder : public SQLQueryHolder
|
||||
{
|
||||
private:
|
||||
uint32 m_accountId;
|
||||
uint64 m_guid;
|
||||
public:
|
||||
LoginQueryHolder(uint32 accountId, uint64 guid)
|
||||
: m_accountId(accountId), m_guid(guid) { }
|
||||
uint64 GetGuid() const { return m_guid; }
|
||||
uint32 GetAccountId() const { return m_accountId; }
|
||||
bool Initialize();
|
||||
private:
|
||||
uint32 m_accountId;
|
||||
uint64 m_guid;
|
||||
public:
|
||||
LoginQueryHolder(uint32 accountId, uint64 guid)
|
||||
: m_accountId(accountId), m_guid(guid) { }
|
||||
uint64 GetGuid() const { return m_guid; }
|
||||
uint32 GetAccountId() const { return m_accountId; }
|
||||
bool Initialize();
|
||||
};
|
||||
|
||||
bool LoginQueryHolder::Initialize()
|
||||
@@ -216,8 +216,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
|
||||
_legitCharacters.insert(guidlow);
|
||||
++num;
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
data.put<uint8>(0, num);
|
||||
@@ -225,7 +224,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleCharEnumOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
// remove expired bans
|
||||
// pussywizard: moved to world update to do it once >_>
|
||||
@@ -390,152 +389,71 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
switch (_charCreateCallback.GetStage())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_NAME_IN_USE);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT(_charCreateCallback.GetParam() == createInfo);
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SUM_REALM_CHARACTERS);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
|
||||
_charCreateCallback.FreeResult();
|
||||
_charCreateCallback.SetFutureResult(LoginDatabase.AsyncQuery(stmt));
|
||||
_charCreateCallback.NextStage();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
uint16 acctCharCount = 0;
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
// SELECT SUM(x) is MYSQL_TYPE_NEWDECIMAL - needs to be read as string
|
||||
const char* ch = fields[0].GetCString();
|
||||
if (ch)
|
||||
acctCharCount = atoi(ch);
|
||||
}
|
||||
|
||||
if (acctCharCount >= sWorld->getIntConfig(CONFIG_CHARACTERS_PER_ACCOUNT))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_ACCOUNT_LIMIT);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ASSERT(_charCreateCallback.GetParam() == createInfo);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
|
||||
_charCreateCallback.FreeResult();
|
||||
_charCreateCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
|
||||
_charCreateCallback.NextStage();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
createInfo->CharCount = uint8(fields[0].GetUInt64()); // SQL's COUNT() returns uint64 but it will always be less than uint8.Max
|
||||
|
||||
if (createInfo->CharCount >= sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM))
|
||||
if (result)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_SERVER_LIMIT);
|
||||
data << uint8(CHAR_CREATE_NAME_IN_USE);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||
ASSERT(_charCreateCallback.GetParam() == createInfo);
|
||||
|
||||
_charCreateCallback.FreeResult();
|
||||
|
||||
if (!allowTwoSideAccounts || skipCinematics == 1 || createInfo->Class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CREATE_INFO);
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_SUM_REALM_CHARACTERS);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
stmt->setUInt32(1, (skipCinematics == 1 || createInfo->Class == CLASS_DEATH_KNIGHT) ? 10 : 1);
|
||||
_charCreateCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
|
||||
|
||||
_charCreateCallback.FreeResult();
|
||||
_charCreateCallback.SetFutureResult(LoginDatabase.AsyncQuery(stmt));
|
||||
_charCreateCallback.NextStage();
|
||||
return;
|
||||
}
|
||||
|
||||
_charCreateCallback.NextStage();
|
||||
HandleCharCreateCallback(PreparedQueryResult(nullptr), createInfo); // Will jump to case 3
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
bool haveSameRace = false;
|
||||
uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
|
||||
bool hasHeroicReqLevel = (heroicReqLevel == 0);
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||
|
||||
if (result)
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
TeamId teamId = Player::TeamIdForRace(createInfo->Race);
|
||||
uint32 freeHeroicSlots = sWorld->getIntConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
|
||||
|
||||
Field* field = result->Fetch();
|
||||
uint8 accRace = field[1].GetUInt8();
|
||||
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT)
|
||||
uint16 acctCharCount = 0;
|
||||
if (result)
|
||||
{
|
||||
uint8 accClass = field[2].GetUInt8();
|
||||
if (accClass == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if (freeHeroicSlots > 0)
|
||||
--freeHeroicSlots;
|
||||
|
||||
if (freeHeroicSlots == 0)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_UNIQUE_CLASS_LIMIT);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasHeroicReqLevel)
|
||||
{
|
||||
uint8 accLevel = field[0].GetUInt8();
|
||||
if (accLevel >= heroicReqLevel)
|
||||
hasHeroicReqLevel = true;
|
||||
}
|
||||
Field* fields = result->Fetch();
|
||||
// SELECT SUM(x) is MYSQL_TYPE_NEWDECIMAL - needs to be read as string
|
||||
const char* ch = fields[0].GetCString();
|
||||
if (ch)
|
||||
acctCharCount = atoi(ch);
|
||||
}
|
||||
|
||||
// need to check team only for first character
|
||||
// TODO: what to if account already has characters of both races?
|
||||
if (!allowTwoSideAccounts)
|
||||
if (acctCharCount >= sWorld->getIntConfig(CONFIG_CHARACTERS_PER_ACCOUNT))
|
||||
{
|
||||
uint32 accTeamId = TEAM_NEUTRAL;
|
||||
if (accRace > 0)
|
||||
accTeamId = Player::TeamIdForRace(accRace);
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_ACCOUNT_LIMIT);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (accTeamId != teamId)
|
||||
|
||||
ASSERT(_charCreateCallback.GetParam() == createInfo);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
|
||||
_charCreateCallback.FreeResult();
|
||||
_charCreateCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
|
||||
_charCreateCallback.NextStage();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
createInfo->CharCount = uint8(fields[0].GetUInt64()); // SQL's COUNT() returns uint64 but it will always be less than uint8.Max
|
||||
|
||||
if (createInfo->CharCount >= sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_PVP_TEAMS_VIOLATION);
|
||||
data << uint8(CHAR_CREATE_SERVER_LIMIT);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
@@ -543,23 +461,45 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
}
|
||||
}
|
||||
|
||||
// search same race for cinematic or same class if need
|
||||
// TODO: check if cinematic already shown? (already logged in?; cinematic field)
|
||||
while ((skipCinematics == 1 && !haveSameRace) || createInfo->Class == CLASS_DEATH_KNIGHT)
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||
|
||||
_charCreateCallback.FreeResult();
|
||||
|
||||
if (!allowTwoSideAccounts || skipCinematics == 1 || createInfo->Class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if (!result->NextRow())
|
||||
break;
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CREATE_INFO);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
stmt->setUInt32(1, (skipCinematics == 1 || createInfo->Class == CLASS_DEATH_KNIGHT) ? 10 : 1);
|
||||
_charCreateCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
|
||||
_charCreateCallback.NextStage();
|
||||
return;
|
||||
}
|
||||
|
||||
field = result->Fetch();
|
||||
accRace = field[1].GetUInt8();
|
||||
_charCreateCallback.NextStage();
|
||||
HandleCharCreateCallback(PreparedQueryResult(nullptr), createInfo); // Will jump to case 3
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
bool haveSameRace = false;
|
||||
uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
|
||||
bool hasHeroicReqLevel = (heroicReqLevel == 0);
|
||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||
|
||||
if (!haveSameRace)
|
||||
haveSameRace = createInfo->Race == accRace;
|
||||
if (result)
|
||||
{
|
||||
TeamId teamId = Player::TeamIdForRace(createInfo->Race);
|
||||
uint32 freeHeroicSlots = sWorld->getIntConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
|
||||
|
||||
Field* field = result->Fetch();
|
||||
uint8 accRace = field[1].GetUInt8();
|
||||
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
uint8 acc_class = field[2].GetUInt8();
|
||||
if (acc_class == CLASS_DEATH_KNIGHT)
|
||||
uint8 accClass = field[2].GetUInt8();
|
||||
if (accClass == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if (freeHeroicSlots > 0)
|
||||
--freeHeroicSlots;
|
||||
@@ -577,100 +517,159 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
|
||||
if (!hasHeroicReqLevel)
|
||||
{
|
||||
uint8 acc_level = field[0].GetUInt8();
|
||||
if (acc_level >= heroicReqLevel)
|
||||
uint8 accLevel = field[0].GetUInt8();
|
||||
if (accLevel >= heroicReqLevel)
|
||||
hasHeroicReqLevel = true;
|
||||
}
|
||||
}
|
||||
|
||||
// need to check team only for first character
|
||||
// TODO: what to if account already has characters of both races?
|
||||
if (!allowTwoSideAccounts)
|
||||
{
|
||||
uint32 accTeamId = TEAM_NEUTRAL;
|
||||
if (accRace > 0)
|
||||
accTeamId = Player::TeamIdForRace(accRace);
|
||||
|
||||
if (accTeamId != teamId)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_PVP_TEAMS_VIOLATION);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// search same race for cinematic or same class if need
|
||||
// TODO: check if cinematic already shown? (already logged in?; cinematic field)
|
||||
while ((skipCinematics == 1 && !haveSameRace) || createInfo->Class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if (!result->NextRow())
|
||||
break;
|
||||
|
||||
field = result->Fetch();
|
||||
accRace = field[1].GetUInt8();
|
||||
|
||||
if (!haveSameRace)
|
||||
haveSameRace = createInfo->Race == accRace;
|
||||
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
uint8 acc_class = field[2].GetUInt8();
|
||||
if (acc_class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if (freeHeroicSlots > 0)
|
||||
--freeHeroicSlots;
|
||||
|
||||
if (freeHeroicSlots == 0)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_UNIQUE_CLASS_LIMIT);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasHeroicReqLevel)
|
||||
{
|
||||
uint8 acc_level = field[0].GetUInt8();
|
||||
if (acc_level >= heroicReqLevel)
|
||||
hasHeroicReqLevel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT && !hasHeroicReqLevel)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_LEVEL_REQUIREMENT);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT && !hasHeroicReqLevel)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_LEVEL_REQUIREMENT);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (createInfo->Data.rpos() < createInfo->Data.wpos())
|
||||
{
|
||||
uint8 unk;
|
||||
createInfo->Data >> unk;
|
||||
if (createInfo->Data.rpos() < createInfo->Data.wpos())
|
||||
{
|
||||
uint8 unk;
|
||||
createInfo->Data >> unk;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk);
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// pussywizard:
|
||||
if (sWorld->GetGlobalPlayerGUID(createInfo->Name))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_NAME_IN_USE);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
Player newChar(this);
|
||||
newChar.GetMotionMaster()->Initialize();
|
||||
if (!newChar.Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo))
|
||||
{
|
||||
// Player not create (race/class/etc problem?)
|
||||
newChar.CleanupsBeforeDelete();
|
||||
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_ERROR);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((haveSameRace && skipCinematics == 1) || skipCinematics == 2)
|
||||
newChar.setCinematic(1); // not show intro
|
||||
|
||||
newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login
|
||||
|
||||
// Player created, save it now
|
||||
newChar.SaveToDB(true, false);
|
||||
createInfo->CharCount += 1;
|
||||
|
||||
SQLTransaction trans = LoginDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS_BY_REALM);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
stmt->setUInt32(1, realmID);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS);
|
||||
stmt->setUInt32(0, createInfo->CharCount);
|
||||
stmt->setUInt32(1, GetAccountId());
|
||||
stmt->setUInt32(2, realmID);
|
||||
trans->Append(stmt);
|
||||
|
||||
LoginDatabase.CommitTransaction(trans);
|
||||
|
||||
// pussywizard:
|
||||
if (sWorld->GetGlobalPlayerGUID(createInfo->Name))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_NAME_IN_USE);
|
||||
data << uint8(CHAR_CREATE_SUCCESS);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
Player newChar(this);
|
||||
newChar.GetMotionMaster()->Initialize();
|
||||
if (!newChar.Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo))
|
||||
{
|
||||
// Player not create (race/class/etc problem?)
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
#endif
|
||||
sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
sScriptMgr->OnPlayerCreate(&newChar);
|
||||
sWorld->AddGlobalPlayerData(newChar.GetGUIDLow(), GetAccountId(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel(), 0, 0);
|
||||
|
||||
newChar.CleanupsBeforeDelete();
|
||||
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_ERROR);
|
||||
SendPacket(&data);
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((haveSameRace && skipCinematics == 1) || skipCinematics == 2)
|
||||
newChar.setCinematic(1); // not show intro
|
||||
|
||||
newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login
|
||||
|
||||
// Player created, save it now
|
||||
newChar.SaveToDB(true, false);
|
||||
createInfo->CharCount += 1;
|
||||
|
||||
SQLTransaction trans = LoginDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS_BY_REALM);
|
||||
stmt->setUInt32(0, GetAccountId());
|
||||
stmt->setUInt32(1, realmID);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS);
|
||||
stmt->setUInt32(0, createInfo->CharCount);
|
||||
stmt->setUInt32(1, GetAccountId());
|
||||
stmt->setUInt32(2, realmID);
|
||||
trans->Append(stmt);
|
||||
|
||||
LoginDatabase.CommitTransaction(trans);
|
||||
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1);
|
||||
data << uint8(CHAR_CREATE_SUCCESS);
|
||||
SendPacket(&data);
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
#endif
|
||||
sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
sScriptMgr->OnPlayerCreate(&newChar);
|
||||
sWorld->AddGlobalPlayerData(newChar.GetGUIDLow(), GetAccountId(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel(), 0, 0);
|
||||
|
||||
newChar.CleanupsBeforeDelete();
|
||||
delete createInfo;
|
||||
_charCreateCallback.Reset();
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,7 +752,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (PlayerLoading() || GetPlayer() != nullptr)
|
||||
{
|
||||
@@ -771,7 +770,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData)
|
||||
KickPlayer("Account can't login with this character");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// pussywizard:
|
||||
if (WorldSession* sess = sWorld->FindOfflineSessionForCharacterGUID(GUID_LOPART(playerGuid)))
|
||||
if (sess->GetAccountId() != GetAccountId())
|
||||
@@ -860,7 +859,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData)
|
||||
|
||||
m_playerLoading = true;
|
||||
|
||||
LoginQueryHolder *holder = new LoginQueryHolder(GetAccountId(), playerGuid);
|
||||
LoginQueryHolder* holder = new LoginQueryHolder(GetAccountId(), playerGuid);
|
||||
if (!holder->Initialize())
|
||||
{
|
||||
delete holder; // delete all unprocessed queries
|
||||
@@ -876,7 +875,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
uint64 playerGuid = holder->GetGuid();
|
||||
|
||||
Player* pCurrChar = new Player(this);
|
||||
// for send server info and strings (config)
|
||||
// for send server info and strings (config)
|
||||
ChatHandler chH = ChatHandler(this);
|
||||
|
||||
// "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
|
||||
@@ -947,7 +946,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
}
|
||||
|
||||
|
||||
data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4);
|
||||
data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4 + 4);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
@@ -1076,7 +1075,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
pCurrChar->CheckAllAchievementCriteria();
|
||||
}
|
||||
|
||||
// Reputations if "StartAllReputation" is enabled, -- TODO: Fix this in a better way
|
||||
// Reputations if "StartAllReputation" is enabled, -- TODO: Fix this in a better way
|
||||
if (sWorld->getBoolConfig(CONFIG_START_ALL_REP))
|
||||
{
|
||||
ReputationMgr& repMgr = pCurrChar->GetReputationMgr();
|
||||
@@ -1132,7 +1131,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
|
||||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
|
||||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
|
||||
|
||||
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
|
||||
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
@@ -1185,7 +1184,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
continue;
|
||||
if ((isReferrer && pCurrChar->GetSession()->GetAccountId() == itr->second->GetRecruiterId()) || (!isReferrer && pCurrChar->GetSession()->GetRecruiterId() == itr->second->GetAccountId()))
|
||||
{
|
||||
Player * rf = itr->second->GetPlayer();
|
||||
Player* rf = itr->second->GetPlayer();
|
||||
if (rf != nullptr)
|
||||
{
|
||||
pCurrChar->SendUpdateToPlayer(rf);
|
||||
@@ -1197,7 +1196,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
|
||||
sScriptMgr->OnPlayerLogin(pCurrChar);
|
||||
|
||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
|
||||
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
|
||||
{
|
||||
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
|
||||
sScriptMgr->OnFirstLogin(pCurrChar);
|
||||
@@ -1241,7 +1240,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
||||
#endif
|
||||
}
|
||||
|
||||
data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4+4);
|
||||
data.Initialize(SMSG_LEARNED_DANCE_MOVES, 4 + 4);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
@@ -1280,10 +1279,10 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
||||
|
||||
for (int32 eff = 0; eff < 96; ++eff)
|
||||
{
|
||||
if (eff != 0 && eff%32 == 0)
|
||||
if (eff != 0 && eff % 32 == 0)
|
||||
_mask[i++] = 0;
|
||||
|
||||
_mask[i] = uint32(1) << (eff-(32*i));
|
||||
_mask[i] = uint32(1) << (eff - (32 * i));
|
||||
int32 val = 0;
|
||||
for (SpellModList::const_iterator itr = spellMods.begin(); itr != spellMods.end(); ++itr)
|
||||
if ((*itr)->type == modType && (*itr)->mask & _mask)
|
||||
@@ -1292,7 +1291,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
||||
if (val == 0)
|
||||
continue;
|
||||
|
||||
WorldPacket data(Opcode, (1+1+4));
|
||||
WorldPacket data(Opcode, (1 + 1 + 4));
|
||||
data << uint8(eff);
|
||||
data << uint8(opType);
|
||||
data << int32(val);
|
||||
@@ -1300,7 +1299,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Group* group = pCurrChar->GetGroup())
|
||||
group->SendUpdate();
|
||||
|
||||
@@ -1351,7 +1350,7 @@ void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
//I think this function is never used :/ I dunno, but i guess this opcode not exists
|
||||
void WorldSession::HandleSetFactionCheat(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleSetFactionCheat(WorldPacket& /*recvData*/)
|
||||
{
|
||||
sLog->outError("WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
|
||||
GetPlayer()->GetReputationMgr().SendStates();
|
||||
@@ -1373,13 +1372,13 @@ void WorldSession::HandleTutorialFlag(WorldPacket& recvData)
|
||||
SetTutorialInt(index, flag);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTutorialClear(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleTutorialClear(WorldPacket& /*recvData*/)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
SetTutorialInt(i, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTutorialReset(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleTutorialReset(WorldPacket& /*recvData*/)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
SetTutorialInt(i, 0x00000000);
|
||||
@@ -1395,7 +1394,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData)
|
||||
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_INACTIVE");
|
||||
@@ -1445,7 +1444,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
|
||||
uint8 res = ObjectMgr::CheckPlayerName(newName, true);
|
||||
if (res != CHAR_NAME_SUCCESS)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + (newName.size() + 1));
|
||||
data << uint8(res);
|
||||
data << uint64(guid);
|
||||
data << newName;
|
||||
@@ -1524,7 +1523,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
|
||||
|
||||
sLog->outChar("Account: %d (IP: %s), Character [%s] (guid: %u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
|
||||
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + (newName.size() + 1));
|
||||
data << uint8(RESPONSE_SUCCESS);
|
||||
data << uint64(guid);
|
||||
data << newName;
|
||||
@@ -1549,7 +1548,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
std::string name;
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(guid, name))
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
SendPacket(&data);
|
||||
@@ -1559,7 +1558,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
std::wstring wname;
|
||||
if (!Utf8toWStr(name, wname))
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
SendPacket(&data);
|
||||
@@ -1568,7 +1567,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
|
||||
if (!isCyrillicCharacter(wname[0])) // name already stored as only single alphabet using
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
SendPacket(&data);
|
||||
@@ -1582,7 +1581,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
|
||||
if (name2 != name) // character have different name
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
SendPacket(&data);
|
||||
@@ -1594,7 +1593,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
recvData >> declinedname.name[i];
|
||||
if (!normalizePlayerName(declinedname.name[i]))
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
SendPacket(&data);
|
||||
@@ -1604,7 +1603,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
|
||||
if (!ObjectMgr::CheckDeclinedNames(wname, declinedname))
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
SendPacket(&data);
|
||||
@@ -1624,13 +1623,13 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
|
||||
for (uint8 i = 0; i < 5; i++)
|
||||
stmt->setString(i+1, declinedname.name[i]);
|
||||
stmt->setString(i + 1, declinedname.name[i]);
|
||||
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(0); // OK
|
||||
data << uint64(guid);
|
||||
SendPacket(&data);
|
||||
@@ -1743,7 +1742,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
{
|
||||
sLog->outError("Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
recvData.rfinish();
|
||||
KickPlayer("HandleCharCustomize");
|
||||
return;
|
||||
@@ -1862,9 +1861,9 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
|
||||
// xinef: update global data
|
||||
sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newName);
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid), PLAYER_UPDATE_DATA_NAME|PLAYER_UPDATE_DATA_GENDER, newName, 0, gender);
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid), PLAYER_UPDATE_DATA_NAME | PLAYER_UPDATE_DATA_GENDER, newName, 0, gender);
|
||||
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1+8+(newName.size()+1)+6);
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1 + 8 + (newName.size() + 1) + 6);
|
||||
data << uint8(RESPONSE_SUCCESS);
|
||||
data << uint64(guid);
|
||||
data << newName;
|
||||
@@ -1877,7 +1876,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
|
||||
void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_SAVE");
|
||||
@@ -1938,7 +1937,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
|
||||
_player->SetEquipmentSet(index, eqSet);
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetDelete(WorldPacket &recvData)
|
||||
void WorldSession::HandleEquipmentSetDelete(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_DELETE");
|
||||
@@ -1950,7 +1949,7 @@ void WorldSession::HandleEquipmentSetDelete(WorldPacket &recvData)
|
||||
_player->DeleteEquipmentSet(setGuid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
|
||||
void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_USE");
|
||||
@@ -1981,14 +1980,17 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
|
||||
item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
|
||||
|
||||
|
||||
InventoryResult msg;
|
||||
|
||||
Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (uItem) {
|
||||
if (uItem->IsEquipped()) {
|
||||
if (uItem)
|
||||
{
|
||||
if (uItem->IsEquipped())
|
||||
{
|
||||
msg = _player->CanUnequipItem(dstpos, true);
|
||||
if (msg != EQUIP_ERR_OK) {
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, uItem, nullptr);
|
||||
continue;
|
||||
}
|
||||
@@ -2010,14 +2012,17 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
|
||||
}
|
||||
}
|
||||
|
||||
if (item) {
|
||||
if (item)
|
||||
{
|
||||
if (item->GetPos() == dstpos)
|
||||
continue;
|
||||
|
||||
if (!item->IsEquipped()) {
|
||||
if (!item->IsEquipped())
|
||||
{
|
||||
uint16 _candidatePos;
|
||||
msg = _player->CanEquipItem(NULL_SLOT, _candidatePos, item, true);
|
||||
if (msg != EQUIP_ERR_OK) {
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
_player->SendEquipError(msg, item, nullptr);
|
||||
continue;
|
||||
}
|
||||
@@ -2042,7 +2047,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
{
|
||||
sLog->outError("Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
recvData.rfinish();
|
||||
KickPlayer("HandleCharFactionOrRaceChange");
|
||||
return;
|
||||
@@ -2105,9 +2110,9 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
|
||||
// check auctions, current packet is processed single-threaded way, so not a problem
|
||||
bool has_auctions = false;
|
||||
for (uint8 i=0; i<2; ++i) // check both neutral and faction-specific AH
|
||||
for (uint8 i = 0; i < 2; ++i) // check both neutral and faction-specific AH
|
||||
{
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(i == 0 ? 0 : (((1<<(playerData->race-1))&RACEMASK_ALLIANCE) ? 12 : 29));
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(i == 0 ? 0 : (((1 << (playerData->race - 1))&RACEMASK_ALLIANCE) ? 12 : 29));
|
||||
AuctionHouseObject::AuctionEntryMap::const_iterator itr = auctionHouse->GetAuctionsBegin();
|
||||
AuctionHouseObject::AuctionEntryMap::const_iterator _end = auctionHouse->GetAuctionsEnd();
|
||||
for (; itr != _end; ++itr)
|
||||
@@ -2157,7 +2162,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
// xinef: check money
|
||||
bool valid = Player::TeamIdForRace(oldRace) == Player::TeamIdForRace(race);
|
||||
if ((level < 10 && money <= 0) || (level > 10 && level <= 30 && money <= 3000000 ) || (level > 30 && level <= 50 && money <= 10000000) ||
|
||||
(level > 50 && level <= 70 && money <= 50000000) || (level > 70 && money <= 200000000))
|
||||
(level > 50 && level <= 70 && money <= 50000000) || (level > 70 && money <= 200000000))
|
||||
valid = true;
|
||||
if (!valid)
|
||||
{
|
||||
@@ -2267,8 +2272,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
|
||||
// xinef: update global data
|
||||
sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newname);
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid),
|
||||
PLAYER_UPDATE_DATA_NAME|PLAYER_UPDATE_DATA_RACE|PLAYER_UPDATE_DATA_GENDER, newname, 0, gender, race);
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid),
|
||||
PLAYER_UPDATE_DATA_NAME | PLAYER_UPDATE_DATA_RACE | PLAYER_UPDATE_DATA_GENDER, newname, 0, gender, race);
|
||||
|
||||
if (oldRace != race)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 type;
|
||||
uint32 lang;
|
||||
@@ -144,17 +144,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
case CHAT_MSG_RAID:
|
||||
case CHAT_MSG_GUILD:
|
||||
case CHAT_MSG_BATTLEGROUND:
|
||||
// check if addon messages are disabled
|
||||
if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
}
|
||||
// check if addon messages are disabled
|
||||
if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
{
|
||||
std::string msg;
|
||||
recvData >> msg;
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
{
|
||||
std::string msg;
|
||||
recvData >> msg;
|
||||
|
||||
if (msg.empty())
|
||||
return;
|
||||
@@ -166,27 +166,27 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
// check if addon messages are disabled
|
||||
if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
}
|
||||
// check if addon messages are disabled
|
||||
if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
{
|
||||
std::string to, msg;
|
||||
recvData >> to >> msg;
|
||||
if (msg.empty())
|
||||
return;
|
||||
}
|
||||
if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON))
|
||||
{
|
||||
std::string to, msg;
|
||||
recvData >> to >> msg;
|
||||
if (msg.empty())
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -208,29 +208,29 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
case CHAT_MSG_RAID:
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
// allow two side chat at group channel if two side group allowed
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||
lang = LANG_UNIVERSAL;
|
||||
case CHAT_MSG_PARTY:
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
case CHAT_MSG_RAID:
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
// allow two side chat at group channel if two side group allowed
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||
lang = LANG_UNIVERSAL;
|
||||
|
||||
specialMessageLimit = 35;
|
||||
break;
|
||||
case CHAT_MSG_GUILD:
|
||||
case CHAT_MSG_OFFICER:
|
||||
// allow two side chat at guild channel if two side guild allowed
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
lang = LANG_UNIVERSAL;
|
||||
specialMessageLimit = 35;
|
||||
break;
|
||||
case CHAT_MSG_GUILD:
|
||||
case CHAT_MSG_OFFICER:
|
||||
// allow two side chat at guild channel if two side guild allowed
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||
lang = LANG_UNIVERSAL;
|
||||
|
||||
specialMessageLimit = 15;
|
||||
break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
if (sender->getLevel() >= 80)
|
||||
specialMessageLimit = 15;
|
||||
break;
|
||||
break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
if (sender->getLevel() >= 80)
|
||||
specialMessageLimit = 15;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
||||
@@ -318,8 +318,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
size_t found1 = msg.find("|Hquest");
|
||||
if (found1 != std::string::npos)
|
||||
{
|
||||
size_t found2 = msg.find(":", found1+8);
|
||||
size_t found3 = msg.find("|", found1+8);
|
||||
size_t found2 = msg.find(":", found1 + 8);
|
||||
size_t found3 = msg.find("|", found1 + 8);
|
||||
if (found3 != std::string::npos)
|
||||
{
|
||||
if (found2 == std::string::npos)
|
||||
@@ -330,7 +330,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
// prevent crash player
|
||||
if (msg.find("| |Hquest") != std::string::npos) {
|
||||
if (msg.find("| |Hquest") != std::string::npos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,255 +342,293 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
case CHAT_MSG_SAY:
|
||||
case CHAT_MSG_EMOTE:
|
||||
case CHAT_MSG_YELL:
|
||||
{
|
||||
// Prevent cheating
|
||||
if (!sender->IsAlive())
|
||||
return;
|
||||
|
||||
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetAcoreString(LANG_SAY_REQ), sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
// Prevent cheating
|
||||
if (!sender->IsAlive())
|
||||
return;
|
||||
|
||||
if (type == CHAT_MSG_SAY)
|
||||
sender->Say(msg, lang);
|
||||
else if (type == CHAT_MSG_EMOTE)
|
||||
sender->TextEmote(msg);
|
||||
else if (type == CHAT_MSG_YELL)
|
||||
sender->Yell(msg, lang);
|
||||
} break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
{
|
||||
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetAcoreString(LANG_WHISPER_REQ), sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!normalizePlayerName(to))
|
||||
{
|
||||
SendPlayerNotFoundNotice(to);
|
||||
break;
|
||||
}
|
||||
|
||||
Player* receiver = ObjectAccessor::FindPlayerByName(to, false);
|
||||
bool senderIsPlayer = AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER);
|
||||
if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
|
||||
{
|
||||
SendPlayerNotFoundNotice(to);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer)
|
||||
if (GetPlayer()->GetTeamId() != receiver->GetTeamId())
|
||||
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ))
|
||||
{
|
||||
SendWrongFactionNotice();
|
||||
SendNotification(GetAcoreString(LANG_SAY_REQ), sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
// pussywizard: optimization
|
||||
if (GetPlayer()->HasAura(1852) && !receiver->IsGameMaster())
|
||||
{
|
||||
SendNotification(GetAcoreString(LANG_GM_SILENCE), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
if (type == CHAT_MSG_SAY)
|
||||
sender->Say(msg, lang);
|
||||
else if (type == CHAT_MSG_EMOTE)
|
||||
sender->TextEmote(msg);
|
||||
else if (type == CHAT_MSG_YELL)
|
||||
sender->Yell(msg, lang);
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_WHISPER:
|
||||
{
|
||||
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetAcoreString(LANG_WHISPER_REQ), sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
|
||||
// If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to
|
||||
if (!senderIsPlayer && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))
|
||||
sender->AddWhisperWhiteList(receiver->GetGUID());
|
||||
if (!normalizePlayerName(to))
|
||||
{
|
||||
SendPlayerNotFoundNotice(to);
|
||||
break;
|
||||
}
|
||||
|
||||
GetPlayer()->Whisper(msg, lang, receiver->GetGUID());
|
||||
} break;
|
||||
Player* receiver = ObjectAccessor::FindPlayerByName(to, false);
|
||||
bool senderIsPlayer = AccountMgr::IsPlayerAccount(GetSecurity());
|
||||
bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER);
|
||||
if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
|
||||
{
|
||||
SendPlayerNotFoundNotice(to);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer)
|
||||
if (GetPlayer()->GetTeamId() != receiver->GetTeamId())
|
||||
{
|
||||
SendWrongFactionNotice();
|
||||
return;
|
||||
}
|
||||
|
||||
// pussywizard: optimization
|
||||
if (GetPlayer()->HasAura(1852) && !receiver->IsGameMaster())
|
||||
{
|
||||
SendNotification(GetAcoreString(LANG_GM_SILENCE), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to
|
||||
if (!senderIsPlayer && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))
|
||||
sender->AddWhisperWhiteList(receiver->GetGUID());
|
||||
|
||||
GetPlayer()->Whisper(msg, lang, receiver->GetGUID());
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_PARTY:
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
{
|
||||
// if player is in battleground, he cannot say to battleground members by /p
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = sender->GetGroup();
|
||||
if (!group || group->isBGGroup())
|
||||
// if player is in battleground, he cannot say to battleground members by /p
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = sender->GetGroup();
|
||||
if (!group || group->isBGGroup())
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == CHAT_MSG_PARTY_LEADER && !group->IsLeader(sender->GetGUID()))
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == CHAT_MSG_PARTY_LEADER && !group->IsLeader(sender->GetGUID()))
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
|
||||
} break;
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, ChatMsg(type), Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false, group->GetMemberGroup(GetPlayer()->GetGUID()));
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_GUILD:
|
||||
{
|
||||
if (GetPlayer()->GetGuildId())
|
||||
{
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||
if (GetPlayer()->GetGuildId())
|
||||
{
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||
{
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
||||
return;
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
||||
return;
|
||||
#endif
|
||||
guild->BroadcastToGuild(this, false, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||
guild->BroadcastToGuild(this, false, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
break;
|
||||
case CHAT_MSG_OFFICER:
|
||||
{
|
||||
if (GetPlayer()->GetGuildId())
|
||||
{
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||
if (GetPlayer()->GetGuildId())
|
||||
{
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
|
||||
{
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, guild);
|
||||
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
||||
return;
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, guild))
|
||||
return;
|
||||
#endif
|
||||
guild->BroadcastToGuild(this, true, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||
guild->BroadcastToGuild(this, true, msg, lang == LANG_ADDON ? LANG_ADDON : LANG_UNIVERSAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
break;
|
||||
case CHAT_MSG_RAID:
|
||||
{
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = GetPlayer()->GetGroup();
|
||||
if (!group || group->isBGGroup() || !group->isRaidGroup())
|
||||
return;
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
} break;
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
{
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = GetPlayer()->GetGroup();
|
||||
if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(sender->GetGUID()))
|
||||
return;
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
} break;
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
{
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
//in battleground, raid warning is sent only to players in battleground - code is ok
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_WARNING, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
} break;
|
||||
case CHAT_MSG_BATTLEGROUND:
|
||||
{
|
||||
//battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isBGGroup())
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
} break;
|
||||
case CHAT_MSG_BATTLEGROUND_LEADER:
|
||||
{
|
||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND_LEADER, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
} break;
|
||||
case CHAT_MSG_CHANNEL:
|
||||
{
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
{
|
||||
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
SendNotification(GetAcoreString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ));
|
||||
group = GetPlayer()->GetGroup();
|
||||
if (!group || group->isBGGroup() || !group->isRaidGroup())
|
||||
return;
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
{
|
||||
// if player is in battleground, he cannot say to battleground members by /ra
|
||||
Group* group = GetPlayer()->GetOriginalGroup();
|
||||
if (!group)
|
||||
{
|
||||
group = GetPlayer()->GetGroup();
|
||||
if (!group || group->isBGGroup() || !group->isRaidGroup() || !group->IsLeader(sender->GetGUID()))
|
||||
return;
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_LEADER, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
{
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isRaidGroup() || !(group->IsLeader(GetPlayer()->GetGUID()) || group->IsAssistant(GetPlayer()->GetGUID())) || group->isBGGroup())
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
//in battleground, raid warning is sent only to players in battleground - code is ok
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_RAID_WARNING, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_BATTLEGROUND:
|
||||
{
|
||||
//battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isBGGroup())
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_BATTLEGROUND_LEADER:
|
||||
{
|
||||
// battleground raid is always in Player->GetGroup(), never in GetOriginalGroup()
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group || !group->isBGGroup() || !group->IsLeader(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
|
||||
sScriptMgr->OnPlayerChat(GetPlayer(), type, lang, msg, group);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(GetPlayer(), type, lang, msg, group))
|
||||
return;
|
||||
#endif
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_BATTLEGROUND_LEADER, Language(lang), sender, NULL, msg);
|
||||
group->BroadcastPacket(&data, false);
|
||||
}
|
||||
break;
|
||||
case CHAT_MSG_CHANNEL:
|
||||
{
|
||||
if (AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
{
|
||||
if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ))
|
||||
{
|
||||
SendNotification(GetAcoreString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ChannelMgr* cMgr = ChannelMgr::forTeam(sender->GetTeamId()))
|
||||
{
|
||||
if (Channel* chn = cMgr->GetChannel(channel, sender))
|
||||
{
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg, chn);
|
||||
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(sender, type, lang, msg, chn))
|
||||
return;
|
||||
#endif
|
||||
chn->Say(sender->GetGUID(), msg.c_str(), lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ChannelMgr* cMgr = ChannelMgr::forTeam(sender->GetTeamId()))
|
||||
break;
|
||||
case CHAT_MSG_AFK:
|
||||
{
|
||||
if (Channel* chn = cMgr->GetChannel(channel, sender))
|
||||
if (!sender->IsInCombat())
|
||||
{
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg, chn);
|
||||
if (sender->isAFK()) // Already AFK
|
||||
{
|
||||
if (msg.empty())
|
||||
sender->ToggleAFK(); // Remove AFK
|
||||
else
|
||||
sender->autoReplyMsg = msg; // Update message
|
||||
}
|
||||
else // New AFK mode
|
||||
{
|
||||
sender->autoReplyMsg = msg.empty() ? GetAcoreString(LANG_PLAYER_AFK_DEFAULT) : msg;
|
||||
|
||||
if (sender->isDND())
|
||||
sender->ToggleDND();
|
||||
|
||||
sender->ToggleAFK();
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(sender, type, lang, msg, chn))
|
||||
if (!sEluna->OnChat(sender, type, lang, msg))
|
||||
return;
|
||||
#endif
|
||||
chn->Say(sender->GetGUID(), msg.c_str(), lang);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case CHAT_MSG_AFK:
|
||||
{
|
||||
if (!sender->IsInCombat())
|
||||
case CHAT_MSG_DND:
|
||||
{
|
||||
if (sender->isAFK()) // Already AFK
|
||||
if (sender->isDND()) // Already DND
|
||||
{
|
||||
if (msg.empty())
|
||||
sender->ToggleAFK(); // Remove AFK
|
||||
sender->ToggleDND(); // Remove DND
|
||||
else
|
||||
sender->autoReplyMsg = msg; // Update message
|
||||
sender->autoReplyMsg = msg; // Update message
|
||||
}
|
||||
else // New AFK mode
|
||||
else // New DND mode
|
||||
{
|
||||
sender->autoReplyMsg = msg.empty() ? GetAcoreString(LANG_PLAYER_AFK_DEFAULT) : msg;
|
||||
sender->autoReplyMsg = msg.empty() ? GetAcoreString(LANG_PLAYER_DND_DEFAULT) : msg;
|
||||
|
||||
if (sender->isDND())
|
||||
sender->ToggleDND();
|
||||
if (sender->isAFK())
|
||||
sender->ToggleAFK();
|
||||
|
||||
sender->ToggleAFK();
|
||||
sender->ToggleDND();
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||
@@ -597,42 +636,15 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||
if (!sEluna->OnChat(sender, type, lang, msg))
|
||||
return;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CHAT_MSG_DND:
|
||||
{
|
||||
if (sender->isDND()) // Already DND
|
||||
{
|
||||
if (msg.empty())
|
||||
sender->ToggleDND(); // Remove DND
|
||||
else
|
||||
sender->autoReplyMsg = msg; // Update message
|
||||
}
|
||||
else // New DND mode
|
||||
{
|
||||
sender->autoReplyMsg = msg.empty() ? GetAcoreString(LANG_PLAYER_DND_DEFAULT) : msg;
|
||||
|
||||
if (sender->isAFK())
|
||||
sender->ToggleAFK();
|
||||
|
||||
sender->ToggleDND();
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerChat(sender, type, lang, msg);
|
||||
#ifdef ELUNA
|
||||
if (!sEluna->OnChat(sender, type, lang, msg))
|
||||
return;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError("CHAT: unknown message type %u, lang: %u", type, lang);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleEmoteOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleEmoteOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (!GetPlayer()->IsAlive() || GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||
return;
|
||||
@@ -655,35 +667,35 @@ namespace acore
|
||||
{
|
||||
class EmoteChatBuilder
|
||||
{
|
||||
public:
|
||||
EmoteChatBuilder(Player const& player, uint32 text_emote, uint32 emote_num, Unit const* target)
|
||||
: i_player(player), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
|
||||
public:
|
||||
EmoteChatBuilder(Player const& player, uint32 text_emote, uint32 emote_num, Unit const* target)
|
||||
: i_player(player), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
|
||||
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
std::string const name(i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
|
||||
uint32 namlen = name.size();
|
||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||
{
|
||||
std::string const name(i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
|
||||
uint32 namlen = name.size();
|
||||
|
||||
data.Initialize(SMSG_TEXT_EMOTE, 20 + namlen);
|
||||
data << i_player.GetGUID();
|
||||
data << uint32(i_text_emote);
|
||||
data << uint32(i_emote_num);
|
||||
data << uint32(namlen);
|
||||
if (namlen > 1)
|
||||
data << name;
|
||||
else
|
||||
data << uint8(0x00);
|
||||
}
|
||||
data.Initialize(SMSG_TEXT_EMOTE, 20 + namlen);
|
||||
data << i_player.GetGUID();
|
||||
data << uint32(i_text_emote);
|
||||
data << uint32(i_emote_num);
|
||||
data << uint32(namlen);
|
||||
if (namlen > 1)
|
||||
data << name;
|
||||
else
|
||||
data << uint8(0x00);
|
||||
}
|
||||
|
||||
private:
|
||||
Player const& i_player;
|
||||
uint32 i_text_emote;
|
||||
uint32 i_emote_num;
|
||||
Unit const* i_target;
|
||||
private:
|
||||
Player const& i_player;
|
||||
uint32 i_text_emote;
|
||||
uint32 i_emote_num;
|
||||
Unit const* i_target;
|
||||
};
|
||||
} // namespace acore
|
||||
|
||||
void WorldSession::HandleTextEmoteOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (!GetPlayer()->IsAlive())
|
||||
return;
|
||||
@@ -726,8 +738,8 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recvData)
|
||||
// Only allow text-emotes for "dead" entities (feign death included)
|
||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||
break;
|
||||
GetPlayer()->HandleEmoteCommand(emote_anim);
|
||||
break;
|
||||
GetPlayer()->HandleEmoteCommand(emote_anim);
|
||||
break;
|
||||
}
|
||||
|
||||
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
|
||||
@@ -768,7 +780,7 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData)
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket)
|
||||
void WorldSession::HandleChannelDeclineInvite(WorldPacket& recvPacket)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(recvPacket);
|
||||
@@ -780,14 +792,14 @@ void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket)
|
||||
|
||||
void WorldSession::SendPlayerNotFoundNotice(std::string const& name)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, name.size()+1);
|
||||
WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, name.size() + 1);
|
||||
data << name;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendPlayerAmbiguousNotice(std::string const& name)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAT_PLAYER_AMBIGUOUS, name.size()+1);
|
||||
WorldPacket data(SMSG_CHAT_PLAYER_AMBIGUOUS, name.size() + 1);
|
||||
data << name;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData)
|
||||
_player->Attack(pEnemy, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAttackStopOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleAttackStopOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
GetPlayer()->AttackStop();
|
||||
}
|
||||
@@ -81,7 +81,7 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::SendAttackStop(Unit const* enemy)
|
||||
{
|
||||
WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); // we guess size
|
||||
WorldPacket data(SMSG_ATTACKSTOP, (8 + 8 + 4)); // we guess size
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data.append(enemy ? enemy->GetPackGUID() : 0); // must be packed guid
|
||||
data << uint32(0); // unk, can be 1 also
|
||||
|
||||
@@ -263,7 +263,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
|
||||
group->BroadcastGroupUpdate();
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DECLINE");
|
||||
@@ -417,7 +417,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
|
||||
group->SendUpdate();
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DISBAND");
|
||||
@@ -524,7 +524,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData)
|
||||
/********************/
|
||||
|
||||
// everything's fine, do it
|
||||
WorldPacket data(MSG_MINIMAP_PING, (8+4+4));
|
||||
WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4));
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << float(x);
|
||||
data << float(y);
|
||||
@@ -551,7 +551,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData)
|
||||
|
||||
//sLog->outDebug("ROLL: MIN: %u, MAX: %u, ROLL: %u", minimum, maximum, roll);
|
||||
|
||||
WorldPacket data(MSG_RANDOM_ROLL, 4+4+4+8);
|
||||
WorldPacket data(MSG_RANDOM_ROLL, 4 + 4 + 4 + 8);
|
||||
data << uint32(minimum);
|
||||
data << uint32(maximum);
|
||||
data << uint32(roll);
|
||||
@@ -603,7 +603,7 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_RAID_CONVERT");
|
||||
@@ -748,10 +748,10 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
|
||||
{
|
||||
// Check if player is in BG
|
||||
if (_player->InBattleground())
|
||||
{
|
||||
_player->GetSession()->SendNotification(LANG_BG_READY_CHECK_ERROR);
|
||||
return;
|
||||
}
|
||||
{
|
||||
_player->GetSession()->SendNotification(LANG_BG_READY_CHECK_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// everything's fine, do it
|
||||
@@ -774,7 +774,7 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleRaidReadyCheckFinishedOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleRaidReadyCheckFinishedOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
//Group* group = GetPlayer()->GetGroup();
|
||||
//if (!group)
|
||||
@@ -965,14 +965,14 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
|
||||
if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT)
|
||||
{
|
||||
if (Vehicle* veh = player->GetVehicle())
|
||||
*data << uint32(veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.transport.seat]);
|
||||
* data << uint32(veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.transport.seat]);
|
||||
else
|
||||
*data << uint32(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
|
||||
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
|
||||
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
|
||||
uint64 Guid;
|
||||
@@ -981,7 +981,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
|
||||
Player* player = HashMapHolder<Player>::Find(Guid);
|
||||
if (!player)
|
||||
{
|
||||
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
|
||||
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3 + 4 + 2);
|
||||
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
|
||||
data.appendPackGUID(Guid);
|
||||
data << uint32(GROUP_UPDATE_FLAG_STATUS);
|
||||
@@ -993,21 +993,21 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
|
||||
Pet* pet = player->GetPet();
|
||||
Powers powerType = player->getPowerType();
|
||||
|
||||
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
|
||||
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4 + 2 + 2 + 2 + 1 + 2 * 6 + 8 + 1 + 8);
|
||||
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
|
||||
data.append(player->GetPackGUID());
|
||||
|
||||
uint32 updateFlags = GROUP_UPDATE_FLAG_STATUS | GROUP_UPDATE_FLAG_CUR_HP | GROUP_UPDATE_FLAG_MAX_HP
|
||||
| GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER | GROUP_UPDATE_FLAG_LEVEL
|
||||
| GROUP_UPDATE_FLAG_ZONE | GROUP_UPDATE_FLAG_POSITION | GROUP_UPDATE_FLAG_AURAS
|
||||
| GROUP_UPDATE_FLAG_PET_NAME | GROUP_UPDATE_FLAG_PET_MODEL_ID | GROUP_UPDATE_FLAG_PET_AURAS;
|
||||
| GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER | GROUP_UPDATE_FLAG_LEVEL
|
||||
| GROUP_UPDATE_FLAG_ZONE | GROUP_UPDATE_FLAG_POSITION | GROUP_UPDATE_FLAG_AURAS
|
||||
| GROUP_UPDATE_FLAG_PET_NAME | GROUP_UPDATE_FLAG_PET_MODEL_ID | GROUP_UPDATE_FLAG_PET_AURAS;
|
||||
|
||||
if (powerType != POWER_MANA)
|
||||
updateFlags |= GROUP_UPDATE_FLAG_POWER_TYPE;
|
||||
|
||||
if (pet)
|
||||
updateFlags |= GROUP_UPDATE_FLAG_PET_GUID | GROUP_UPDATE_FLAG_PET_CUR_HP | GROUP_UPDATE_FLAG_PET_MAX_HP
|
||||
| GROUP_UPDATE_FLAG_PET_POWER_TYPE | GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER;
|
||||
| GROUP_UPDATE_FLAG_PET_POWER_TYPE | GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER;
|
||||
|
||||
if (player->GetVehicle())
|
||||
updateFlags |= GROUP_UPDATE_FLAG_VEHICLE_SEAT;
|
||||
@@ -1107,7 +1107,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
/*!*/void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket & /*recvData*/)
|
||||
/*!*/void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
// every time the player checks the character screen
|
||||
_player->SendRaidInfo();
|
||||
@@ -1120,7 +1120,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
|
||||
#endif
|
||||
}*/
|
||||
|
||||
void WorldSession::HandleOptOutOfLootOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_OPT_OUT_OF_LOOT");
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
#include "SocialMgr.h"
|
||||
|
||||
// Cleanup bad characters
|
||||
void cleanStr(std::string &str) {
|
||||
void cleanStr(std::string& str)
|
||||
{
|
||||
str.erase(remove(str.begin(), str.end(), '|'), str.end());
|
||||
}
|
||||
|
||||
@@ -27,7 +28,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket)
|
||||
recvPacket >> guildId;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId);
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId);
|
||||
#endif
|
||||
if (!guildId)
|
||||
return;
|
||||
@@ -226,7 +227,7 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_SET_OFFICER_NOTE [%s]: Target: %s, Note: %s",
|
||||
GetPlayerInfo().c_str(), playerName.c_str(), note.c_str());
|
||||
GetPlayerInfo().c_str(), playerName.c_str(), note.c_str());
|
||||
#endif
|
||||
|
||||
// Check for overflow
|
||||
@@ -349,10 +350,10 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD
|
||||
"] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
|
||||
, GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle()
|
||||
, emblemInfo.GetColor(), emblemInfo.GetBorderStyle()
|
||||
, emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor());
|
||||
"] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
|
||||
, GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle()
|
||||
, emblemInfo.GetColor(), emblemInfo.GetBorderStyle()
|
||||
, emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor());
|
||||
#endif
|
||||
if (GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER))
|
||||
{
|
||||
@@ -379,7 +380,7 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */)
|
||||
guild->SendEventLog(this);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recvData */)
|
||||
void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket& /* recvData */)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s]", GetPlayerInfo().c_str());
|
||||
@@ -408,9 +409,9 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u"
|
||||
, GetPlayerInfo().c_str(), guid, sendAllSlots);
|
||||
, GetPlayerInfo().c_str(), guid, sendAllSlots);
|
||||
#endif
|
||||
Guild * const guild = GetPlayer()->GetGuild();
|
||||
Guild* const guild = GetPlayer()->GetGuild();
|
||||
if (!guild)
|
||||
{
|
||||
Guild::SendCommandResult(this, GUILD_COMMAND_VIEW_TAB, ERR_GUILD_PLAYER_NOT_IN_GUILD);
|
||||
@@ -431,7 +432,7 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u"
|
||||
, GetPlayerInfo().c_str(), guid, tabId, full);
|
||||
, GetPlayerInfo().c_str(), guid, tabId, full);
|
||||
#endif
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
@@ -446,7 +447,7 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
|
||||
GetPlayerInfo().c_str(), guid, money);
|
||||
GetPlayerInfo().c_str(), guid, money);
|
||||
#endif
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (money && GetPlayer()->HasEnoughMoney(money))
|
||||
@@ -462,7 +463,7 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
|
||||
GetPlayerInfo().c_str(), guid, money);
|
||||
GetPlayerInfo().c_str(), guid, money);
|
||||
#endif
|
||||
if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
@@ -579,7 +580,7 @@ void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s"
|
||||
, GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str());
|
||||
, GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str());
|
||||
#endif
|
||||
|
||||
// Check for overflow
|
||||
@@ -608,7 +609,7 @@ void WorldSession::HandleGuildBankLogQuery(WorldPacket& recvData)
|
||||
guild->SendBankLog(this, tabId);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recvData)
|
||||
void WorldSession::HandleQueryGuildBankTabText(WorldPacket& recvData)
|
||||
{
|
||||
uint8 tabId;
|
||||
recvData >> tabId;
|
||||
@@ -621,7 +622,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recvData)
|
||||
guild->SendBankTabText(this, tabId);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetGuildBankTabText(WorldPacket &recvData)
|
||||
void WorldSession::HandleSetGuildBankTabText(WorldPacket& recvData)
|
||||
{
|
||||
uint8 tabId;
|
||||
std::string text;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
void WorldSession::HandleSplitItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SPLIT_ITEM");
|
||||
uint8 srcbag, srcslot, dstbag, dstslot;
|
||||
@@ -49,7 +49,7 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket & recvData)
|
||||
_player->SplitItem(src, dst, count);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_INV_ITEM");
|
||||
uint8 srcslot, dstslot;
|
||||
@@ -91,7 +91,7 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket & recvData)
|
||||
_player->SwapItem(src, dst);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 itemguid;
|
||||
uint8 dstslot;
|
||||
@@ -110,7 +110,7 @@ void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket & recvData)
|
||||
_player->SwapItem(item->GetPos(), dstpos);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSwapItem(WorldPacket & recvData)
|
||||
void WorldSession::HandleSwapItem(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM");
|
||||
uint8 dstbag, dstslot, srcbag, srcslot;
|
||||
@@ -152,7 +152,7 @@ void WorldSession::HandleSwapItem(WorldPacket & recvData)
|
||||
_player->SwapItem(src, dst);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOEQUIP_ITEM");
|
||||
uint8 srcbag, srcslot;
|
||||
@@ -249,7 +249,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleDestroyItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_DESTROYITEM");
|
||||
uint8 bag, slot, count, data1, data2, data3;
|
||||
@@ -424,7 +424,7 @@ void ItemTemplate::InitializeQueryData()
|
||||
}
|
||||
|
||||
// Only _static_ data send in this packet !!!
|
||||
void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_ITEM_QUERY_SINGLE");
|
||||
uint32 item;
|
||||
@@ -437,144 +437,144 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recvData)
|
||||
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
|
||||
if (pProto)
|
||||
{
|
||||
std::string Name = pProto->Name1;
|
||||
std::string Description = pProto->Description;
|
||||
std::string Name = pProto->Name1;
|
||||
std::string Description = pProto->Description;
|
||||
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (ItemLocale const* il = sObjectMgr->GetItemLocale(pProto->ItemId))
|
||||
{
|
||||
ObjectMgr::GetLocaleString(il->Name, loc_idx, Name);
|
||||
ObjectMgr::GetLocaleString(il->Description, loc_idx, Description);
|
||||
}
|
||||
}
|
||||
// guess size
|
||||
WorldPacket queryData(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600);
|
||||
queryData << pProto->ItemId;
|
||||
queryData << pProto->Class;
|
||||
queryData << pProto->SubClass;
|
||||
queryData << pProto->SoundOverrideSubclass;
|
||||
queryData << Name;
|
||||
queryData << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
|
||||
queryData << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00);
|
||||
queryData << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00);
|
||||
queryData << pProto->DisplayInfoID;
|
||||
queryData << pProto->Quality;
|
||||
queryData << pProto->Flags;
|
||||
queryData << pProto->Flags2;
|
||||
queryData << pProto->BuyPrice;
|
||||
queryData << pProto->SellPrice;
|
||||
queryData << pProto->InventoryType;
|
||||
queryData << pProto->AllowableClass;
|
||||
queryData << pProto->AllowableRace;
|
||||
queryData << pProto->ItemLevel;
|
||||
queryData << pProto->RequiredLevel;
|
||||
queryData << pProto->RequiredSkill;
|
||||
queryData << pProto->RequiredSkillRank;
|
||||
queryData << pProto->RequiredSpell;
|
||||
queryData << pProto->RequiredHonorRank;
|
||||
queryData << pProto->RequiredCityRank;
|
||||
queryData << pProto->RequiredReputationFaction;
|
||||
queryData << pProto->RequiredReputationRank;
|
||||
queryData << int32(pProto->MaxCount);
|
||||
queryData << int32(pProto->Stackable);
|
||||
queryData << pProto->ContainerSlots;
|
||||
queryData << pProto->StatsCount; // item stats count
|
||||
for (uint32 i = 0; i < pProto->StatsCount; ++i)
|
||||
{
|
||||
queryData << pProto->ItemStat[i].ItemStatType;
|
||||
queryData << pProto->ItemStat[i].ItemStatValue;
|
||||
}
|
||||
queryData << pProto->ScalingStatDistribution; // scaling stats distribution
|
||||
queryData << pProto->ScalingStatValue; // some kind of flags used to determine stat values column
|
||||
for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
|
||||
{
|
||||
queryData << pProto->Damage[i].DamageMin;
|
||||
queryData << pProto->Damage[i].DamageMax;
|
||||
queryData << pProto->Damage[i].DamageType;
|
||||
}
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (ItemLocale const* il = sObjectMgr->GetItemLocale(pProto->ItemId))
|
||||
{
|
||||
ObjectMgr::GetLocaleString(il->Name, loc_idx, Name);
|
||||
ObjectMgr::GetLocaleString(il->Description, loc_idx, Description);
|
||||
}
|
||||
}
|
||||
// guess size
|
||||
WorldPacket queryData(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600);
|
||||
queryData << pProto->ItemId;
|
||||
queryData << pProto->Class;
|
||||
queryData << pProto->SubClass;
|
||||
queryData << pProto->SoundOverrideSubclass;
|
||||
queryData << Name;
|
||||
queryData << uint8(0x00); //pProto->Name2; // blizz not send name there, just uint8(0x00); <-- \0 = empty string = empty name...
|
||||
queryData << uint8(0x00); //pProto->Name3; // blizz not send name there, just uint8(0x00);
|
||||
queryData << uint8(0x00); //pProto->Name4; // blizz not send name there, just uint8(0x00);
|
||||
queryData << pProto->DisplayInfoID;
|
||||
queryData << pProto->Quality;
|
||||
queryData << pProto->Flags;
|
||||
queryData << pProto->Flags2;
|
||||
queryData << pProto->BuyPrice;
|
||||
queryData << pProto->SellPrice;
|
||||
queryData << pProto->InventoryType;
|
||||
queryData << pProto->AllowableClass;
|
||||
queryData << pProto->AllowableRace;
|
||||
queryData << pProto->ItemLevel;
|
||||
queryData << pProto->RequiredLevel;
|
||||
queryData << pProto->RequiredSkill;
|
||||
queryData << pProto->RequiredSkillRank;
|
||||
queryData << pProto->RequiredSpell;
|
||||
queryData << pProto->RequiredHonorRank;
|
||||
queryData << pProto->RequiredCityRank;
|
||||
queryData << pProto->RequiredReputationFaction;
|
||||
queryData << pProto->RequiredReputationRank;
|
||||
queryData << int32(pProto->MaxCount);
|
||||
queryData << int32(pProto->Stackable);
|
||||
queryData << pProto->ContainerSlots;
|
||||
queryData << pProto->StatsCount; // item stats count
|
||||
for (uint32 i = 0; i < pProto->StatsCount; ++i)
|
||||
{
|
||||
queryData << pProto->ItemStat[i].ItemStatType;
|
||||
queryData << pProto->ItemStat[i].ItemStatValue;
|
||||
}
|
||||
queryData << pProto->ScalingStatDistribution; // scaling stats distribution
|
||||
queryData << pProto->ScalingStatValue; // some kind of flags used to determine stat values column
|
||||
for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
|
||||
{
|
||||
queryData << pProto->Damage[i].DamageMin;
|
||||
queryData << pProto->Damage[i].DamageMax;
|
||||
queryData << pProto->Damage[i].DamageType;
|
||||
}
|
||||
|
||||
// resistances (7)
|
||||
queryData << pProto->Armor;
|
||||
queryData << pProto->HolyRes;
|
||||
queryData << pProto->FireRes;
|
||||
queryData << pProto->NatureRes;
|
||||
queryData << pProto->FrostRes;
|
||||
queryData << pProto->ShadowRes;
|
||||
queryData << pProto->ArcaneRes;
|
||||
// resistances (7)
|
||||
queryData << pProto->Armor;
|
||||
queryData << pProto->HolyRes;
|
||||
queryData << pProto->FireRes;
|
||||
queryData << pProto->NatureRes;
|
||||
queryData << pProto->FrostRes;
|
||||
queryData << pProto->ShadowRes;
|
||||
queryData << pProto->ArcaneRes;
|
||||
|
||||
queryData << pProto->Delay;
|
||||
queryData << pProto->AmmoType;
|
||||
queryData << pProto->RangedModRange;
|
||||
queryData << pProto->Delay;
|
||||
queryData << pProto->AmmoType;
|
||||
queryData << pProto->RangedModRange;
|
||||
|
||||
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
||||
{
|
||||
// send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown
|
||||
// use `item_template` or if not set then only use spell cooldowns
|
||||
SpellInfo const* spell = sSpellMgr->GetSpellInfo(pProto->Spells[s].SpellId);
|
||||
if (spell)
|
||||
{
|
||||
bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0;
|
||||
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
||||
{
|
||||
// send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown
|
||||
// use `item_template` or if not set then only use spell cooldowns
|
||||
SpellInfo const* spell = sSpellMgr->GetSpellInfo(pProto->Spells[s].SpellId);
|
||||
if (spell)
|
||||
{
|
||||
bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0;
|
||||
|
||||
queryData << pProto->Spells[s].SpellId;
|
||||
queryData << pProto->Spells[s].SpellTrigger;
|
||||
queryData << uint32(-abs(pProto->Spells[s].SpellCharges));
|
||||
queryData << pProto->Spells[s].SpellId;
|
||||
queryData << pProto->Spells[s].SpellTrigger;
|
||||
queryData << uint32(-abs(pProto->Spells[s].SpellCharges));
|
||||
|
||||
if (db_data)
|
||||
{
|
||||
queryData << uint32(pProto->Spells[s].SpellCooldown);
|
||||
queryData << uint32(pProto->Spells[s].SpellCategory);
|
||||
queryData << uint32(pProto->Spells[s].SpellCategoryCooldown);
|
||||
}
|
||||
else
|
||||
{
|
||||
queryData << uint32(spell->RecoveryTime);
|
||||
queryData << uint32(spell->GetCategory());
|
||||
queryData << uint32(spell->CategoryRecoveryTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(-1);
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(-1);
|
||||
}
|
||||
}
|
||||
queryData << pProto->Bonding;
|
||||
queryData << Description;
|
||||
queryData << pProto->PageText;
|
||||
queryData << pProto->LanguageID;
|
||||
queryData << pProto->PageMaterial;
|
||||
queryData << pProto->StartQuest;
|
||||
queryData << pProto->LockID;
|
||||
queryData << int32(pProto->Material);
|
||||
queryData << pProto->Sheath;
|
||||
queryData << pProto->RandomProperty;
|
||||
queryData << pProto->RandomSuffix;
|
||||
queryData << pProto->Block;
|
||||
queryData << pProto->ItemSet;
|
||||
queryData << pProto->MaxDurability;
|
||||
queryData << pProto->Area;
|
||||
queryData << pProto->Map; // Added in 1.12.x & 2.0.1 client branch
|
||||
queryData << pProto->BagFamily;
|
||||
queryData << pProto->TotemCategory;
|
||||
for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s)
|
||||
{
|
||||
queryData << pProto->Socket[s].Color;
|
||||
queryData << pProto->Socket[s].Content;
|
||||
}
|
||||
queryData << pProto->socketBonus;
|
||||
queryData << pProto->GemProperties;
|
||||
queryData << pProto->RequiredDisenchantSkill;
|
||||
queryData << pProto->ArmorDamageModifier;
|
||||
queryData << pProto->Duration; // added in 2.4.2.8209, duration (seconds)
|
||||
queryData << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory
|
||||
queryData << pProto->HolidayId; // Holiday.dbc?
|
||||
SendPacket(&queryData);
|
||||
if (db_data)
|
||||
{
|
||||
queryData << uint32(pProto->Spells[s].SpellCooldown);
|
||||
queryData << uint32(pProto->Spells[s].SpellCategory);
|
||||
queryData << uint32(pProto->Spells[s].SpellCategoryCooldown);
|
||||
}
|
||||
else
|
||||
{
|
||||
queryData << uint32(spell->RecoveryTime);
|
||||
queryData << uint32(spell->GetCategory());
|
||||
queryData << uint32(spell->CategoryRecoveryTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(-1);
|
||||
queryData << uint32(0);
|
||||
queryData << uint32(-1);
|
||||
}
|
||||
}
|
||||
queryData << pProto->Bonding;
|
||||
queryData << Description;
|
||||
queryData << pProto->PageText;
|
||||
queryData << pProto->LanguageID;
|
||||
queryData << pProto->PageMaterial;
|
||||
queryData << pProto->StartQuest;
|
||||
queryData << pProto->LockID;
|
||||
queryData << int32(pProto->Material);
|
||||
queryData << pProto->Sheath;
|
||||
queryData << pProto->RandomProperty;
|
||||
queryData << pProto->RandomSuffix;
|
||||
queryData << pProto->Block;
|
||||
queryData << pProto->ItemSet;
|
||||
queryData << pProto->MaxDurability;
|
||||
queryData << pProto->Area;
|
||||
queryData << pProto->Map; // Added in 1.12.x & 2.0.1 client branch
|
||||
queryData << pProto->BagFamily;
|
||||
queryData << pProto->TotemCategory;
|
||||
for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s)
|
||||
{
|
||||
queryData << pProto->Socket[s].Color;
|
||||
queryData << pProto->Socket[s].Content;
|
||||
}
|
||||
queryData << pProto->socketBonus;
|
||||
queryData << pProto->GemProperties;
|
||||
queryData << pProto->RequiredDisenchantSkill;
|
||||
queryData << pProto->ArmorDamageModifier;
|
||||
queryData << pProto->Duration; // added in 2.4.2.8209, duration (seconds)
|
||||
queryData << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory
|
||||
queryData << pProto->HolidayId; // Holiday.dbc?
|
||||
SendPacket(&queryData);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -587,7 +587,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleReadItem(WorldPacket & recvData)
|
||||
void WorldSession::HandleReadItem(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_READ_ITEM");
|
||||
|
||||
@@ -624,7 +624,7 @@ void WorldSession::HandleReadItem(WorldPacket & recvData)
|
||||
_player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, nullptr);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSellItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SELL_ITEM");
|
||||
@@ -746,7 +746,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
void WorldSession::HandleBuybackItem(WorldPacket & recvData)
|
||||
void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUYBACK_ITEM");
|
||||
@@ -807,7 +807,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recvData)
|
||||
_player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, 0, 0);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
|
||||
@@ -851,7 +851,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recvData)
|
||||
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, bag, bagslot);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBuyItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM");
|
||||
@@ -871,7 +871,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket & recvData)
|
||||
GetPlayer()->BuyItemFromVendorSlot(vendorguid, slot, item, count, NULL_BAG, NULL_SLOT);
|
||||
}
|
||||
|
||||
void WorldSession::HandleListInventoryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
|
||||
@@ -991,7 +991,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOSTORE_BAG_ITEM");
|
||||
uint8 srcbag, srcslot, dstbag;
|
||||
@@ -1090,8 +1090,8 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
||||
_player->SetBankBagSlotCount(slot);
|
||||
_player->ModifyMoney(-int32(price));
|
||||
|
||||
data << uint32(ERR_BANKSLOT_OK);
|
||||
SendPacket(&data);
|
||||
data << uint32(ERR_BANKSLOT_OK);
|
||||
SendPacket(&data);
|
||||
|
||||
_player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT);
|
||||
}
|
||||
@@ -1190,7 +1190,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetAmmoOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (!_player->IsAlive())
|
||||
{
|
||||
@@ -1221,7 +1221,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket & recvData)
|
||||
|
||||
void WorldSession::SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId)
|
||||
{
|
||||
WorldPacket data(SMSG_ENCHANTMENTLOG, (8+8+4+4)); // last check 2.0.10
|
||||
WorldPacket data(SMSG_ENCHANTMENTLOG, (8 + 8 + 4 + 4)); // last check 2.0.10
|
||||
data.appendPackGUID(target);
|
||||
data.appendPackGUID(caster);
|
||||
data << uint32(itemId);
|
||||
@@ -1231,8 +1231,8 @@ void WorldSession::SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemI
|
||||
|
||||
void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration)
|
||||
{
|
||||
// last check 2.0.10
|
||||
WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8+4+4+8));
|
||||
// last check 2.0.10
|
||||
WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8 + 4 + 4 + 8));
|
||||
data << uint64(Itemguid);
|
||||
data << uint32(slot);
|
||||
data << uint32(Duration);
|
||||
@@ -1240,7 +1240,7 @@ void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid,
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 itemid;
|
||||
recvData >> itemid;
|
||||
@@ -1258,7 +1258,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recvData)
|
||||
if (ItemSetNameLocale const* isnl = sObjectMgr->GetItemSetNameLocale(itemid))
|
||||
ObjectMgr::GetLocaleString(isnl->Name, loc_idx, Name);
|
||||
|
||||
WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+Name.size()+1+4));
|
||||
WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4 + Name.size() + 1 + 4));
|
||||
data << uint32(itemid);
|
||||
data << Name;
|
||||
data << uint32(pName->InventoryType);
|
||||
@@ -1346,7 +1346,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// maybe not correct check (it is better than nothing)
|
||||
if (item->GetTemplate()->MaxCount>0)
|
||||
if (item->GetTemplate()->MaxCount > 0)
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
@@ -1365,12 +1365,24 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
|
||||
switch (item->GetEntry())
|
||||
{
|
||||
case 5042: item->SetEntry(5043); break;
|
||||
case 5048: item->SetEntry(5044); break;
|
||||
case 17303: item->SetEntry(17302); break;
|
||||
case 17304: item->SetEntry(17305); break;
|
||||
case 17307: item->SetEntry(17308); break;
|
||||
case 21830: item->SetEntry(21831); break;
|
||||
case 5042:
|
||||
item->SetEntry(5043);
|
||||
break;
|
||||
case 5048:
|
||||
item->SetEntry(5044);
|
||||
break;
|
||||
case 17303:
|
||||
item->SetEntry(17302);
|
||||
break;
|
||||
case 17304:
|
||||
item->SetEntry(17305);
|
||||
break;
|
||||
case 17307:
|
||||
item->SetEntry(17308);
|
||||
break;
|
||||
case 21830:
|
||||
item->SetEntry(21831);
|
||||
break;
|
||||
}
|
||||
item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
|
||||
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED);
|
||||
@@ -1403,7 +1415,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
|
||||
//cheat -> tried to socket same gem multiple times
|
||||
if ((gem_guids[0] && (gem_guids[0] == gem_guids[1] || gem_guids[0] == gem_guids[2])) ||
|
||||
(gem_guids[1] && (gem_guids[1] == gem_guids[2])))
|
||||
(gem_guids[1] && (gem_guids[1] == gem_guids[2])))
|
||||
return;
|
||||
|
||||
Item* itemTarget = _player->GetItemByGuid(item_guid);
|
||||
@@ -1460,7 +1472,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //get new and old enchantments
|
||||
{
|
||||
GemEnchants[i] = (GemProps[i]) ? GemProps[i]->spellitemenchantement : 0;
|
||||
OldEnchants[i] = itemTarget->GetEnchantmentId(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i));
|
||||
OldEnchants[i] = itemTarget->GetEnchantmentId(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i));
|
||||
}
|
||||
|
||||
// check unique-equipped conditions
|
||||
@@ -1559,13 +1571,13 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (GemEnchants[i])
|
||||
{
|
||||
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i), GemEnchants[i], 0, 0, _player->GetGUID());
|
||||
itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i), GemEnchants[i], 0, 0, _player->GetGUID());
|
||||
if (Item* guidItem = _player->GetItemByGuid(gem_guids[i]))
|
||||
_player->DestroyItem(guidItem->GetBagSlot(), guidItem->GetSlot(), true);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true);
|
||||
|
||||
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
|
||||
@@ -1632,7 +1644,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
|
||||
GetPlayer()->SendRefundInfo(item);
|
||||
}
|
||||
|
||||
void WorldSession::HandleItemRefund(WorldPacket &recvData)
|
||||
void WorldSession::HandleItemRefund(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_REFUND");
|
||||
@@ -1661,7 +1673,7 @@ void WorldSession::HandleItemRefund(WorldPacket &recvData)
|
||||
*
|
||||
* This function is called when player clicks on item which has some flag set
|
||||
*/
|
||||
void WorldSession::HandleItemTextQuery(WorldPacket & recvData )
|
||||
void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
|
||||
{
|
||||
uint64 itemGuid;
|
||||
recvData >> itemGuid;
|
||||
@@ -1707,8 +1719,8 @@ bool WorldSession::CanUseBank(uint64 bankerGUID) const
|
||||
bool WorldSession::recoveryItem(Item* pItem)
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_ITEMDELETE_METHOD)
|
||||
&& pItem->GetTemplate()->Quality >= sWorld->getIntConfig(CONFIG_ITEMDELETE_QUALITY)
|
||||
&& pItem->GetTemplate()->ItemLevel >= sWorld->getIntConfig(CONFIG_ITEMDELETE_ITEM_LEVEL))
|
||||
&& pItem->GetTemplate()->Quality >= sWorld->getIntConfig(CONFIG_ITEMDELETE_QUALITY)
|
||||
&& pItem->GetTemplate()->ItemLevel >= sWorld->getIntConfig(CONFIG_ITEMDELETE_ITEM_LEVEL))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_RECOVERY_ITEM);
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ void WorldSession::SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u",
|
||||
GetPlayerInfo().c_str(), updateData.updateType);
|
||||
GetPlayerInfo().c_str(), updateData.updateType);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
|
||||
data << uint8(updateData.updateType); // Lfg Update type
|
||||
@@ -387,7 +387,7 @@ void WorldSession::SendLfgUpdateParty(lfg::LfgUpdateData const& updateData)
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u",
|
||||
GetPlayerInfo().c_str(), updateData.updateType);
|
||||
GetPlayerInfo().c_str(), updateData.updateType);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
|
||||
data << uint8(updateData.updateType); // Lfg Update type
|
||||
@@ -492,9 +492,9 @@ void WorldSession::SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u",
|
||||
GetPlayer()->GetGUID(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
|
||||
GetPlayer()->GetGUID(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 +4 + 1 + 1 + 1 + 4);
|
||||
WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 + 4 + 1 + 1 + 1 + 4);
|
||||
data << uint32(queueData.dungeonId); // Dungeon
|
||||
data << int32(queueData.waitTimeAvg); // Average Wait time
|
||||
data << int32(queueData.waitTime); // Wait Time
|
||||
@@ -514,7 +514,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat
|
||||
return;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u, sdungeonEntry: %u, done: %u",
|
||||
GetPlayerInfo().c_str(), rewardData.rdungeonEntry, rewardData.sdungeonEntry, rewardData.done);
|
||||
GetPlayerInfo().c_str(), rewardData.rdungeonEntry, rewardData.sdungeonEntry, rewardData.done);
|
||||
|
||||
uint8 itemNum = rewardData.quest->GetRewItemsCount();
|
||||
|
||||
@@ -560,7 +560,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
|
||||
}
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s",
|
||||
guid, uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING), uint8(playerVote == lfg::LFG_ANSWER_AGREE), boot.victim, votesNum, agreeNum, secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
|
||||
guid, uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING), uint8(playerVote == lfg::LFG_ANSWER_AGREE), boot.victim, votesNum, agreeNum, secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());
|
||||
data << uint8(boot.inProgress); // Vote in progress
|
||||
@@ -596,7 +596,7 @@ void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal)
|
||||
|
||||
dungeonEntry = sLFGMgr->GetLFGDungeonEntry(dungeonEntry);
|
||||
|
||||
WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + proposal.players.size() * (4 + 1 + 1 + 1 + 1 +1));
|
||||
WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + proposal.players.size() * (4 + 1 + 1 + 1 + 1 + 1));
|
||||
data << uint32(dungeonEntry); // Dungeon
|
||||
data << uint8(proposal.state); // Proposal state
|
||||
data << uint32(proposal.id); // Proposal ID
|
||||
|
||||
@@ -97,7 +97,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||
DoLootRelease(lguid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_MONEY");
|
||||
@@ -114,51 +114,51 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recvData*/)
|
||||
switch (GUID_HIPART(guid))
|
||||
{
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
{
|
||||
GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid);
|
||||
{
|
||||
GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid);
|
||||
|
||||
// do not check distance for GO if player is the owner of it (ex. fishing bobber)
|
||||
if (go && ((go->GetOwnerGUID() == player->GetGUID() || go->IsWithinDistInMap(player, INTERACTION_DISTANCE))))
|
||||
loot = &go->loot;
|
||||
// do not check distance for GO if player is the owner of it (ex. fishing bobber)
|
||||
if (go && ((go->GetOwnerGUID() == player->GetGUID() || go->IsWithinDistInMap(player, INTERACTION_DISTANCE))))
|
||||
loot = &go->loot;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HIGHGUID_CORPSE: // remove insignia ONLY in BG
|
||||
{
|
||||
Corpse* bones = ObjectAccessor::GetCorpse(*player, guid);
|
||||
|
||||
if (bones && bones->IsWithinDistInMap(player, INTERACTION_DISTANCE))
|
||||
{
|
||||
loot = &bones->loot;
|
||||
shareMoney = false;
|
||||
}
|
||||
Corpse* bones = ObjectAccessor::GetCorpse(*player, guid);
|
||||
|
||||
break;
|
||||
}
|
||||
if (bones && bones->IsWithinDistInMap(player, INTERACTION_DISTANCE))
|
||||
{
|
||||
loot = &bones->loot;
|
||||
shareMoney = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case HIGHGUID_ITEM:
|
||||
{
|
||||
if (Item* item = player->GetItemByGuid(guid))
|
||||
{
|
||||
loot = &item->loot;
|
||||
shareMoney = false;
|
||||
if (Item* item = player->GetItemByGuid(guid))
|
||||
{
|
||||
loot = &item->loot;
|
||||
shareMoney = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HIGHGUID_UNIT:
|
||||
case HIGHGUID_VEHICLE:
|
||||
{
|
||||
Creature* creature = player->GetMap()->GetCreature(guid);
|
||||
bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING);
|
||||
if (lootAllowed && creature->IsWithinDistInMap(player, INTERACTION_DISTANCE))
|
||||
{
|
||||
loot = &creature->loot;
|
||||
if (creature->IsAlive())
|
||||
shareMoney = false;
|
||||
Creature* creature = player->GetMap()->GetCreature(guid);
|
||||
bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING);
|
||||
if (lootAllowed && creature->IsWithinDistInMap(player, INTERACTION_DISTANCE))
|
||||
{
|
||||
loot = &creature->loot;
|
||||
if (creature->IsAlive())
|
||||
shareMoney = false;
|
||||
}
|
||||
else
|
||||
player->SendLootError(guid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL);
|
||||
break;
|
||||
}
|
||||
else
|
||||
player->SendLootError(guid, lootAllowed ? LOOT_ERROR_TOO_FAR : LOOT_ERROR_DIDNT_KILL);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return; // unlootable type
|
||||
}
|
||||
@@ -257,8 +257,8 @@ void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::DoLootRelease(uint64 lguid)
|
||||
{
|
||||
Player *player = GetPlayer();
|
||||
Loot *loot;
|
||||
Player* player = GetPlayer();
|
||||
Loot* loot;
|
||||
|
||||
player->SetLootGUID(0);
|
||||
player->SendLootRelease(lguid);
|
||||
@@ -286,7 +286,8 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
|
||||
{
|
||||
if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
|
||||
{ // The fishing hole used once more
|
||||
{
|
||||
// The fishing hole used once more
|
||||
go->AddUse(); // if the max usage is reached, will be despawned in next tick
|
||||
if (go->GetUseCount() >= go->GetGOValue()->FishingHole.MaxOpens)
|
||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
@@ -295,8 +296,8 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
}
|
||||
else
|
||||
{
|
||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
||||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
||||
// Xinef: moved event execution to loot release (after everything is looted)
|
||||
// Xinef: 99% sure that this worked like this on blizz
|
||||
// Xinef: prevents exploits with just opening GO and spawning bilions of npcs, which can crash core if you know what you're doin ;)
|
||||
@@ -504,8 +505,8 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
|
||||
#endif
|
||||
|
||||
// mark as looted
|
||||
item.count=0;
|
||||
item.is_looted=true;
|
||||
item.count = 0;
|
||||
item.is_looted = true;
|
||||
|
||||
loot->NotifyItemRemoved(slotid);
|
||||
--loot->unlootedCount;
|
||||
|
||||
@@ -46,7 +46,7 @@ bool WorldSession::CanOpenMailBox(uint64 guid)
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorldSession::HandleSendMail(WorldPacket & recvData)
|
||||
void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox, unk3;
|
||||
std::string receiver, subject, body;
|
||||
@@ -59,7 +59,8 @@ void WorldSession::HandleSendMail(WorldPacket & recvData)
|
||||
recvData >> subject;
|
||||
|
||||
// prevent client crash
|
||||
if (subject.find("| |") != std::string::npos || body.find("| |") != std::string::npos) {
|
||||
if (subject.find("| |") != std::string::npos || body.find("| |") != std::string::npos)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -196,8 +197,8 @@ void WorldSession::HandleSendMail(WorldPacket & recvData)
|
||||
}*/
|
||||
|
||||
uint32 rc_account = receive
|
||||
? receive->GetSession()->GetAccountId()
|
||||
: sObjectMgr->GetPlayerAccountIdByGUID(rc);
|
||||
? receive->GetSession()->GetAccountId()
|
||||
: sObjectMgr->GetPlayerAccountIdByGUID(rc);
|
||||
|
||||
if (/*!accountBound*/ GetAccountId() != rc_account && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
{
|
||||
@@ -292,7 +293,7 @@ void WorldSession::HandleSendMail(WorldPacket & recvData)
|
||||
needItemDelay = GetAccountId() != rc_account;
|
||||
}
|
||||
|
||||
if( money >= 10*GOLD )
|
||||
if( money >= 10 * GOLD )
|
||||
{
|
||||
CleanStringForMysqlQuery(subject);
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<MAIL> %s\", NOW())", GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), rc_account, receiver.c_str(), money, subject.c_str());
|
||||
@@ -308,16 +309,16 @@ void WorldSession::HandleSendMail(WorldPacket & recvData)
|
||||
|
||||
// will delete item or place to receiver mail list
|
||||
draft
|
||||
.AddMoney(money)
|
||||
.AddCOD(COD)
|
||||
.SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
.AddMoney(money)
|
||||
.AddCOD(COD)
|
||||
.SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
//called when mail is read
|
||||
void WorldSession::HandleMailMarkAsRead(WorldPacket & recvData)
|
||||
void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
uint32 mailId;
|
||||
@@ -340,7 +341,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//called when client deletes mail
|
||||
void WorldSession::HandleMailDelete(WorldPacket & recvData)
|
||||
void WorldSession::HandleMailDelete(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
uint32 mailId;
|
||||
@@ -370,7 +371,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recvData)
|
||||
player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMailReturnToSender(WorldPacket & recvData)
|
||||
void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
uint32 mailId;
|
||||
@@ -433,7 +434,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//called when player takes item attached in mail
|
||||
void WorldSession::HandleMailTakeItem(WorldPacket & recvData)
|
||||
void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
uint32 mailId;
|
||||
@@ -499,10 +500,10 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recvData)
|
||||
if (sender || sender_accId)
|
||||
{
|
||||
MailDraft(m->subject, "")
|
||||
.AddMoney(m->COD)
|
||||
.SendMailTo(trans, MailReceiver(sender, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
|
||||
.AddMoney(m->COD)
|
||||
.SendMailTo(trans, MailReceiver(sender, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
|
||||
|
||||
if( m->COD >= 10*GOLD )
|
||||
if( m->COD >= 10 * GOLD )
|
||||
{
|
||||
std::string senderName;
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(sender_guid, senderName))
|
||||
@@ -574,7 +575,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
//called when player lists his received mails
|
||||
void WorldSession::HandleGetMailList(WorldPacket & recvData)
|
||||
void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
recvData >> mailbox;
|
||||
@@ -611,7 +612,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
|
||||
|
||||
uint8 item_count = uint8((*itr)->items.size()); // max count is MAX_MAIL_ITEMS (12)
|
||||
|
||||
size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+MAX_INSPECTED_ENCHANTMENT_SLOT*3*4+4+4+4+4+4+4+1);
|
||||
size_t next_mail_size = 2 + 4 + 1 + ((*itr)->messageType == MAIL_NORMAL ? 8 : 4) + 4 * 8 + ((*itr)->subject.size() + 1) + ((*itr)->body.size() + 1) + 1 + item_count * (1 + 4 + 4 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3 * 4 + 4 + 4 + 4 + 4 + 4 + 4 + 1);
|
||||
|
||||
if (data.wpos() + next_mail_size > MAX_NETCLIENT_PACKET_SIZE)
|
||||
{
|
||||
@@ -640,10 +641,12 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
|
||||
std::string subject = (*itr)->subject;
|
||||
std::string body = (*itr)->body;
|
||||
|
||||
if (subject.find("| |") != std::string::npos) {
|
||||
if (subject.find("| |") != std::string::npos)
|
||||
{
|
||||
subject = "";
|
||||
}
|
||||
if (body.find("| |") != std::string::npos) {
|
||||
if (body.find("| |") != std::string::npos)
|
||||
{
|
||||
body = "";
|
||||
}
|
||||
|
||||
@@ -652,7 +655,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
|
||||
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
|
||||
data << uint32((*itr)->money); // Gold
|
||||
data << uint32((*itr)->checked); // flags
|
||||
data << float(float((*itr)->expire_time-time(nullptr))/DAY); // Time
|
||||
data << float(float((*itr)->expire_time - time(nullptr)) / DAY); // Time
|
||||
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
|
||||
data << subject; // Subject string - once 00, when mail type = 3, max 256
|
||||
data << body; // message? max 8000
|
||||
@@ -702,7 +705,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//used when player copies mail body to his inventory
|
||||
void WorldSession::HandleMailCreateTextItem(WorldPacket & recvData)
|
||||
void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
uint32 mailId;
|
||||
@@ -771,7 +774,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//TODO Fix me! ... this void has probably bad condition, but good data are sent
|
||||
void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
|
||||
{
|
||||
WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REPOP_REQUEST Message");
|
||||
@@ -85,7 +85,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
|
||||
GetPlayer()->RepopAtGraveyard();
|
||||
}
|
||||
|
||||
void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION");
|
||||
@@ -376,8 +376,8 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
|
||||
if (!str[i].empty())
|
||||
{
|
||||
if (wgname.find(str[i]) != std::wstring::npos ||
|
||||
wpname.find(str[i]) != std::wstring::npos ||
|
||||
Utf8FitTo(aname, str[i]))
|
||||
wpname.find(str[i]) != std::wstring::npos ||
|
||||
Utf8FitTo(aname, str[i]))
|
||||
{
|
||||
s_show = true;
|
||||
break;
|
||||
@@ -412,7 +412,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
|
||||
void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
|
||||
@@ -422,13 +422,13 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
DoLootRelease(lguid);
|
||||
|
||||
bool instantLogout = ((GetSecurity() >= 0 && uint32(GetSecurity()) >= sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT))
|
||||
|| (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())) || GetPlayer()->IsInFlight();
|
||||
|| (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())) || GetPlayer()->IsInFlight();
|
||||
|
||||
bool preventAfkSanctuaryLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT) == 1
|
||||
&& GetPlayer()->isAFK() && sAreaTableStore.LookupEntry(GetPlayer()->GetAreaId())->IsSanctuary();
|
||||
&& GetPlayer()->isAFK() && sAreaTableStore.LookupEntry(GetPlayer()->GetAreaId())->IsSanctuary();
|
||||
|
||||
bool preventAfkLogout = sWorld->getIntConfig(CONFIG_AFK_PREVENT_LOGOUT) == 2
|
||||
&& GetPlayer()->isAFK();
|
||||
&& GetPlayer()->isAFK();
|
||||
|
||||
/// TODO: Possibly add RBAC permission to log out in combat
|
||||
bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
@@ -441,7 +441,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
else if (preventAfkSanctuaryLogout || preventAfkLogout || GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
|
||||
reason = 2; // FIXME - Need the correct value
|
||||
|
||||
WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
|
||||
WorldPacket data(SMSG_LOGOUT_RESPONSE, 1 + 4);
|
||||
data << uint32(reason);
|
||||
data << uint8(instantLogout);
|
||||
SendPacket(&data);
|
||||
@@ -465,7 +465,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
if (GetPlayer()->getStandState() == UNIT_STAND_STATE_STAND)
|
||||
GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
|
||||
WorldPacket data(SMSG_FORCE_MOVE_ROOT, (8+4)); // guess size
|
||||
WorldPacket data(SMSG_FORCE_MOVE_ROOT, (8 + 4)); // guess size
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << (uint32)2;
|
||||
SendPacket(&data);
|
||||
@@ -475,14 +475,14 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
LogoutRequest(time(nullptr));
|
||||
}
|
||||
|
||||
void WorldSession::HandlePlayerLogoutOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandlePlayerLogoutOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_PLAYER_LOGOUT Message");
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
LogoutRequest(0);
|
||||
|
||||
@@ -492,7 +492,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/)
|
||||
// not remove flags if can't free move - its not set in Logout request code.
|
||||
if (GetPlayer()->CanFreeMove())
|
||||
{
|
||||
data.Initialize(SMSG_FORCE_MOVE_UNROOT, 9+4);
|
||||
data.Initialize(SMSG_FORCE_MOVE_UNROOT, 9 + 4);
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
@@ -502,7 +502,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleTogglePvP(WorldPacket & recv_data)
|
||||
void WorldSession::HandleTogglePvP(WorldPacket& recv_data)
|
||||
{
|
||||
// this opcode can be used in two ways: Either set explicit new status or toggle old status
|
||||
if (recv_data.size() == 1)
|
||||
@@ -523,7 +523,7 @@ void WorldSession::HandleTogglePvP(WorldPacket & recv_data)
|
||||
// pvp->HandlePlayerActivityChanged(_player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 newZone;
|
||||
recv_data >> newZone;
|
||||
@@ -539,7 +539,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data)
|
||||
//GetPlayer()->SendInitWorldStates(true, newZone);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetSelectionOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
@@ -547,7 +547,7 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data)
|
||||
_player->SetSelection(guid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleStandStateChangeOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 animstate;
|
||||
recv_data >> animstate;
|
||||
@@ -566,7 +566,7 @@ void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data)
|
||||
_player->SetStandState(animstate);
|
||||
}
|
||||
|
||||
void WorldSession::HandleContactListOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleContactListOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 unk;
|
||||
recv_data >> unk;
|
||||
@@ -576,7 +576,7 @@ void WorldSession::HandleContactListOpcode(WorldPacket & recv_data)
|
||||
_player->GetSocial()->SendSocialList(_player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_FRIEND");
|
||||
@@ -646,7 +646,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleDelFriendOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleDelFriendOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 FriendGUID;
|
||||
|
||||
@@ -665,7 +665,7 @@ void WorldSession::HandleDelFriendOpcode(WorldPacket & recv_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleAddIgnoreOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_IGNORE");
|
||||
@@ -742,11 +742,10 @@ void WorldSession::HandleCharacterAuraFrozen(PreparedQueryResult result)
|
||||
Field* fields = result->Fetch();
|
||||
std::string player = fields[0].GetString();
|
||||
handler.PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str());
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 IgnoreGUID;
|
||||
|
||||
@@ -765,7 +764,7 @@ void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetContactNotesOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_CONTACT_NOTES");
|
||||
@@ -776,7 +775,7 @@ void WorldSession::HandleSetContactNotesOpcode(WorldPacket & recv_data)
|
||||
_player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBugOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleBugOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 suggestion, contentlen, typelen;
|
||||
std::string content, type;
|
||||
@@ -804,7 +803,7 @@ void WorldSession::HandleBugOpcode(WorldPacket & recv_data)
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE");
|
||||
@@ -843,7 +842,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
|
||||
_player->SpawnCorpseBones();
|
||||
}
|
||||
|
||||
void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE");
|
||||
@@ -880,8 +879,8 @@ void WorldSession::SendAreaTriggerMessage(const char* Text, ...)
|
||||
vsnprintf(szStr, 1024, Text, ap);
|
||||
va_end(ap);
|
||||
|
||||
uint32 length = strlen(szStr)+1;
|
||||
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4+length);
|
||||
uint32 length = strlen(szStr) + 1;
|
||||
WorldPacket data(SMSG_AREA_TRIGGER_MESSAGE, 4 + length);
|
||||
data << length;
|
||||
data << szStr;
|
||||
SendPacket(&data);
|
||||
@@ -901,7 +900,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",
|
||||
player->GetName().c_str(), player->GetGUIDLow(), triggerId);
|
||||
player->GetName().c_str(), player->GetGUIDLow(), triggerId);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -911,7 +910,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",
|
||||
player->GetName().c_str(), player->GetGUIDLow(), triggerId);
|
||||
player->GetName().c_str(), player->GetGUIDLow(), triggerId);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -920,7 +919,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
|
||||
player->GetName().c_str(), atEntry->map, player->GetMapId(), player->GetGUIDLow(), triggerId);
|
||||
player->GetName().c_str(), atEntry->map, player->GetMapId(), player->GetGUIDLow(), triggerId);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -977,7 +976,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT);
|
||||
}
|
||||
|
||||
void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
|
||||
void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA");
|
||||
@@ -997,7 +996,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
|
||||
{
|
||||
SetAccountData(AccountDataType(type), 0, "");
|
||||
|
||||
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA_COMPLETE, 4+4);
|
||||
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA_COMPLETE, 4 + 4);
|
||||
data << uint32(type);
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
@@ -1030,7 +1029,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
|
||||
|
||||
SetAccountData(AccountDataType(type), timestamp, adata);
|
||||
|
||||
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA_COMPLETE, 4+4);
|
||||
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA_COMPLETE, 4 + 4);
|
||||
data << uint32(type);
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
@@ -1071,7 +1070,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
|
||||
|
||||
dest.resize(destSize);
|
||||
|
||||
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8+4+4+4+destSize);
|
||||
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8 + 4 + 4 + 4 + destSize);
|
||||
data << uint64(_player ? _player->GetGUID() : 0); // player guid
|
||||
data << uint32(type); // type (0-7)
|
||||
data << uint32(adata->Time); // unix time
|
||||
@@ -1135,21 +1134,21 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCompleteCinematic(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleCompleteCinematic(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC");
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleNextCinematicCamera(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA");
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleFeatherFallAck(WorldPacket &recv_data)
|
||||
void WorldSession::HandleFeatherFallAck(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK");
|
||||
@@ -1163,54 +1162,54 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
|
||||
{
|
||||
// no used
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
/*
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
/*
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
// now can skip not our packet
|
||||
if (_player->GetGUID() != guid)
|
||||
{
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
// now can skip not our packet
|
||||
if (_player->GetGUID() != guid)
|
||||
{
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK");
|
||||
#endif
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK");
|
||||
#endif
|
||||
|
||||
recv_data.read_skip<uint32>(); // unk
|
||||
recv_data.read_skip<uint32>(); // unk
|
||||
|
||||
MovementInfo movementInfo;
|
||||
movementInfo.guid = guid;
|
||||
ReadMovementInfo(recv_data, &movementInfo);
|
||||
recv_data.read_skip<float>(); // unk2
|
||||
*/
|
||||
MovementInfo movementInfo;
|
||||
movementInfo.guid = guid;
|
||||
ReadMovementInfo(recv_data, &movementInfo);
|
||||
recv_data.read_skip<float>(); // unk2
|
||||
*/
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
|
||||
{
|
||||
// no used
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
/*
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
/*
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
// now can skip not our packet
|
||||
if (_player->GetGUID() != guid)
|
||||
{
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
// now can skip not our packet
|
||||
if (_player->GetGUID() != guid)
|
||||
{
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_ROOT_ACK");
|
||||
#endif
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_ROOT_ACK");
|
||||
#endif
|
||||
|
||||
recv_data.read_skip<uint32>(); // unk
|
||||
recv_data.read_skip<uint32>(); // unk
|
||||
|
||||
MovementInfo movementInfo;
|
||||
ReadMovementInfo(recv_data, &movementInfo);
|
||||
*/
|
||||
MovementInfo movementInfo;
|
||||
ReadMovementInfo(recv_data, &movementInfo);
|
||||
*/
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data)
|
||||
@@ -1261,7 +1260,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
|
||||
uint32 talent_points = 0x47;
|
||||
uint32 guid_size = player->GetPackGUID().wpos();
|
||||
WorldPacket data(SMSG_INSPECT_TALENT, guid_size+4+talent_points);
|
||||
WorldPacket data(SMSG_INSPECT_TALENT, guid_size + 4 + talent_points);
|
||||
data.append(player->GetPackGUID());
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_TALENTS_INSPECTING) || _player->IsGameMaster())
|
||||
@@ -1293,7 +1292,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(MSG_INSPECT_HONOR_STATS, 8+1+4*4);
|
||||
WorldPacket data(MSG_INSPECT_HONOR_STATS, 8 + 1 + 4 * 4);
|
||||
data << uint64(player->GetGUID());
|
||||
data << uint8(player->GetHonorPoints());
|
||||
data << uint32(player->GetUInt32Value(PLAYER_FIELD_KILLS));
|
||||
@@ -1396,7 +1395,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
|
||||
std::string msg = charname + "'s " + "account is " + acc + ", e-mail: " + email + ", last ip: " + lastip;
|
||||
|
||||
WorldPacket data(SMSG_WHOIS, msg.size()+1);
|
||||
WorldPacket data(SMSG_WHOIS, msg.size() + 1);
|
||||
data << msg;
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -1405,7 +1404,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleComplainOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleComplainOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_COMPLAIN");
|
||||
@@ -1449,7 +1448,7 @@ void WorldSession::HandleComplainOpcode(WorldPacket & recv_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleRealmSplitOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_REALM_SPLIT");
|
||||
@@ -1459,7 +1458,7 @@ void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data)
|
||||
std::string split_date = "01/01/01";
|
||||
recv_data >> unk;
|
||||
|
||||
WorldPacket data(SMSG_REALM_SPLIT, 4+4+split_date.size()+1);
|
||||
WorldPacket data(SMSG_REALM_SPLIT, 4 + 4 + split_date.size() + 1);
|
||||
data << unk;
|
||||
data << uint32(0x00000000); // realm split state
|
||||
// split states:
|
||||
@@ -1487,7 +1486,8 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
|
||||
#endif
|
||||
if (WorldObject* target = _player->GetViewpoint())
|
||||
_player->SetSeer(target);
|
||||
else {
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outError("Player %s requests non-existing seer " UI64FMTD, _player->GetName().c_str(), _player->GetUInt64Value(PLAYER_FARSIGHT));
|
||||
#endif
|
||||
@@ -1504,7 +1504,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
|
||||
GetPlayer()->UpdateVisibilityForPlayer();
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetTitleOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_TITLE");
|
||||
@@ -1516,7 +1516,7 @@ void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data)
|
||||
// -1 at none
|
||||
if (title > 0 && title < MAX_TITLE_INDEX)
|
||||
{
|
||||
if (!GetPlayer()->HasTitle(title))
|
||||
if (!GetPlayer()->HasTitle(title))
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -1525,7 +1525,7 @@ void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data)
|
||||
GetPlayer()->SetUInt32Value(PLAYER_CHOSEN_TITLE, title);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data)
|
||||
void WorldSession::HandleTimeSyncResp(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 counter, clientTicks;
|
||||
recv_data >> counter >> clientTicks;
|
||||
@@ -1533,7 +1533,7 @@ void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data)
|
||||
_player->m_timeSyncClient = clientTicks;
|
||||
}
|
||||
|
||||
void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_RESET_INSTANCES");
|
||||
@@ -1548,7 +1548,7 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/)
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_ALL, false);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_DUNGEON_DIFFICULTY");
|
||||
@@ -1603,7 +1603,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_RAID_DIFFICULTY");
|
||||
@@ -1656,7 +1656,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()) && (_player->GetRaidDifficulty() >= 0 && uint32(mode % 2) == uint32(_player->GetRaidDifficulty() % 2)) && group->isRaidGroup())
|
||||
{
|
||||
if (!currMap)
|
||||
currMap = groupGuy->GetMap();
|
||||
@@ -1669,8 +1669,8 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
if (!groupGuy->IsAlive() || groupGuy->IsInCombat() || groupGuy->GetVictim() || groupGuy->m_mover != groupGuy || groupGuy->IsNonMeleeSpellCast(true) || (!groupGuy->GetMotionMaster()->empty() && groupGuy->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE)
|
||||
|| !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress()
|
||||
|| !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false))
|
||||
|| !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress()
|
||||
|| !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false))
|
||||
{
|
||||
_player->SendRaidDifficulty(group != nullptr);
|
||||
return;
|
||||
@@ -1695,7 +1695,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
|
||||
if (p->GetGroup() != group)
|
||||
{
|
||||
if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || (!p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE)
|
||||
|| !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress())
|
||||
|| !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress())
|
||||
{
|
||||
_player->SendRaidDifficulty(group != nullptr);
|
||||
return;
|
||||
@@ -1727,15 +1727,15 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
|
||||
{
|
||||
anyoneInside = true;
|
||||
|
||||
float x,y,z,o;
|
||||
groupGuy->GetPosition(x,y,z,o);
|
||||
float x, y, z, o;
|
||||
groupGuy->GetPosition(x, y, z, o);
|
||||
Map* oldMap = groupGuy->GetMap();
|
||||
oldMap->RemovePlayerFromMap(groupGuy, false);
|
||||
groupGuy->ResetMap();
|
||||
oldMap->AfterPlayerUnlinkFromMap();
|
||||
groupGuy->SetMap(homeMap571);
|
||||
groupGuy->Relocate(5790.20f, 2071.36f, 636.07f, 3.60f);
|
||||
Position dest = {x, y, z+0.1f, o};
|
||||
Position dest = {x, y, z + 0.1f, o};
|
||||
playerTeleport[groupGuy] = dest;
|
||||
}
|
||||
}
|
||||
@@ -1765,7 +1765,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCancelMountAuraOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_MOUNT_AURA");
|
||||
@@ -1788,7 +1788,7 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket & /*recv_data*/)
|
||||
_player->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
// fly mode on/off
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
@@ -1816,12 +1816,12 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data)
|
||||
_player->m_mover->m_movementInfo.flags = movementInfo.GetMovementFlags();
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestPetInfoOpcode(WorldPacket & /*recv_data */)
|
||||
void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recv_data */)
|
||||
{
|
||||
/*
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_REQUEST_PET_INFO");
|
||||
#endif
|
||||
#endif
|
||||
recv_data.hexlike();
|
||||
*/
|
||||
|
||||
@@ -1831,7 +1831,7 @@ void WorldSession::HandleRequestPetInfoOpcode(WorldPacket & /*recv_data */)
|
||||
_player->CharmSpellInitialize();
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint8 mode;
|
||||
recv_data >> mode;
|
||||
@@ -1843,7 +1843,7 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket & recv_data)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleQueryInspectAchievements(WorldPacket & recv_data)
|
||||
void WorldSession::HandleQueryInspectAchievements(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
recv_data.readPackGUID(guid);
|
||||
@@ -1885,7 +1885,7 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift)
|
||||
}
|
||||
|
||||
//Battlefield and Battleground
|
||||
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY");
|
||||
@@ -1907,10 +1907,10 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
|
||||
sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
|
||||
|
||||
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
|
||||
bf->SendAreaSpiritHealerQueryOpcode(_player,guid);
|
||||
bf->SendAreaSpiritHealerQueryOpcode(_player, guid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE");
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#define MOVEMENT_PACKET_TIME_DELAY 0
|
||||
|
||||
void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: got MSG_MOVE_WORLDPORT_ACK.");
|
||||
@@ -238,7 +238,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
|
||||
sLog->outStaticDebug("Guid " UI64FMTD, guid);
|
||||
#endif
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS);
|
||||
sLog->outStaticDebug("Flags %u, time %u", flags, time / IN_MILLISECONDS);
|
||||
#endif
|
||||
|
||||
Player* plMover = _player->m_mover->ToPlayer();
|
||||
@@ -261,7 +261,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
|
||||
// xinef: teleport pets if they are not unsummoned
|
||||
if (Pet* pet = plMover->GetPet())
|
||||
{
|
||||
if (!pet->IsWithinDist3d(plMover, plMover->GetMap()->GetVisibilityRange()-5.0f))
|
||||
if (!pet->IsWithinDist3d(plMover, plMover->GetMap()->GetVisibilityRange() - 5.0f))
|
||||
pet->NearTeleportTo(plMover->GetPositionX(), plMover->GetPositionY(), plMover->GetPositionZ(), pet->GetOrientation());
|
||||
}
|
||||
|
||||
@@ -293,11 +293,11 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
|
||||
plMover->GetMotionMaster()->ReinitializeMovement();
|
||||
|
||||
// pussywizard: client forgets about losing control, resend it
|
||||
if (plMover->HasUnitState(UNIT_STATE_FLEEING|UNIT_STATE_CONFUSED) || plMover->IsCharmed()) // only in such cases SetClientControl(self, false) is sent
|
||||
if (plMover->HasUnitState(UNIT_STATE_FLEEING | UNIT_STATE_CONFUSED) || plMover->IsCharmed()) // only in such cases SetClientControl(self, false) is sent
|
||||
plMover->SetClientControl(plMover, false, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
|
||||
void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
{
|
||||
uint16 opcode = recvData.GetOpcode();
|
||||
|
||||
@@ -320,7 +320,8 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
|
||||
recvData.readPackGUID(guid);
|
||||
|
||||
// prevent tampered movement data
|
||||
if (!guid || guid != mover->GetGUID()) {
|
||||
if (!guid || guid != mover->GetGUID())
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
@@ -336,7 +337,8 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
|
||||
movementInfo.guid = guid;
|
||||
ReadMovementInfo(recvData, &movementInfo);
|
||||
|
||||
if (!movementInfo.pos.IsPositionValid()) {
|
||||
if (!movementInfo.pos.IsPositionValid())
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
@@ -352,14 +354,14 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
|
||||
// transports size limited
|
||||
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
|
||||
if (movementInfo.transport.pos.GetPositionX() > 75.0f || movementInfo.transport.pos.GetPositionY() > 75.0f || movementInfo.transport.pos.GetPositionZ() > 75.0f ||
|
||||
movementInfo.transport.pos.GetPositionX() < -75.0f || movementInfo.transport.pos.GetPositionY() < -75.0f || movementInfo.transport.pos.GetPositionZ() < -75.0f)
|
||||
movementInfo.transport.pos.GetPositionX() < -75.0f || movementInfo.transport.pos.GetPositionY() < -75.0f || movementInfo.transport.pos.GetPositionZ() < -75.0f)
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
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()))
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
@@ -509,7 +511,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
|
||||
void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
|
||||
{
|
||||
uint32 opcode = recvData.GetOpcode();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
@@ -550,15 +552,42 @@ 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:
|
||||
sLog->outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode);
|
||||
return;
|
||||
@@ -578,19 +607,19 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData)
|
||||
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
|
||||
{
|
||||
sLog->outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
|
||||
move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed);
|
||||
move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed);
|
||||
_player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true);
|
||||
}
|
||||
else // must be lesser - cheating
|
||||
{
|
||||
sLog->outBasic("Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
|
||||
_player->GetName().c_str(), GetAccountId(), _player->GetSpeed(move_type), newspeed);
|
||||
_player->GetName().c_str(), GetAccountId(), _player->GetSpeed(move_type), newspeed);
|
||||
KickPlayer("Incorrect speed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData)
|
||||
void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
|
||||
@@ -606,7 +635,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData)
|
||||
void WorldSession::HandleMoveNotActiveMover(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
|
||||
@@ -637,7 +666,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvData*/)
|
||||
GetPlayer()->SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveKnockBackAck(WorldPacket & recvData)
|
||||
void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK");
|
||||
@@ -739,7 +768,7 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_TIME_SKIPPED");
|
||||
#endif
|
||||
|
||||
|
||||
uint64 guid;
|
||||
uint32 timeSkipped;
|
||||
recvData.readPackGUID(guid);
|
||||
|
||||
@@ -37,7 +37,7 @@ enum StableResultCode
|
||||
STABLE_ERR_EXOTIC = 0x0C, // "you are unable to control exotic creatures"
|
||||
};
|
||||
|
||||
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid;
|
||||
@@ -65,7 +65,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleBankerActivateOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
|
||||
@@ -106,7 +106,7 @@ void WorldSession::SendShowMailBox(uint64 guid)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTrainerListOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
|
||||
@@ -158,7 +158,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_TRAINER_LIST, 8+4+4+trainer_spells->spellList.size()*38 + strTitle.size()+1);
|
||||
WorldPacket data(SMSG_TRAINER_LIST, 8 + 4 + 4 + trainer_spells->spellList.size() * 38 + strTitle.size() + 1);
|
||||
data << guid;
|
||||
data << uint32(trainer_spells->trainerType);
|
||||
|
||||
@@ -199,7 +199,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
data << uint32(floor(tSpell->spellCost * fDiscountMod));
|
||||
|
||||
data << uint32(primary_prof_first_rank && can_learn_primary_prof ? 1 : 0);
|
||||
// primary prof. learn confirmation dialog
|
||||
// primary prof. learn confirmation dialog
|
||||
data << uint32(primary_prof_first_rank ? 1 : 0); // must be equal prev. field to have learn button in enabled state
|
||||
data << uint8(tSpell->reqLevel);
|
||||
data << uint32(tSpell->reqSkill);
|
||||
@@ -241,7 +241,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
uint32 spellId = 0;
|
||||
@@ -302,7 +302,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GOSSIP_HELLO");
|
||||
@@ -341,7 +341,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData)
|
||||
//if (unit->IsArmorer() || unit->IsCivilian() || unit->IsQuestGiver() || unit->IsServiceProvider() || unit->IsGuard())
|
||||
{
|
||||
//if (!unit->GetTransport()) // pussywizard: reverted with new spline (old: without this check, npc would stay in place and the transport would continue moving, so the npc falls off. NPCs on transports don't have waypoints, so stopmoving is not needed)
|
||||
unit->StopMoving();
|
||||
unit->StopMoving();
|
||||
}
|
||||
|
||||
// If spiritguide, no need for gossip menu, just put player into resurrect queue
|
||||
@@ -358,7 +358,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData)
|
||||
|
||||
if (!sScriptMgr->OnGossipHello(_player, unit))
|
||||
{
|
||||
// _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
|
||||
// _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
|
||||
_player->PrepareGossipMenu(unit, unit->GetCreatureTemplate()->GossipMenuId, true);
|
||||
_player->SendPreparedGossip(unit);
|
||||
}
|
||||
@@ -414,7 +414,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}*/
|
||||
|
||||
void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
|
||||
@@ -471,7 +471,7 @@ void WorldSession::SendSpiritResurrect()
|
||||
// _player->UpdateObjectVisibility(); // xinef: not needed, called in ResurrectPlayer
|
||||
}
|
||||
|
||||
void WorldSession::HandleBinderActivateOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 npcGUID;
|
||||
recvData >> npcGUID;
|
||||
@@ -506,7 +506,7 @@ void WorldSession::SendBindPoint(Creature* npc)
|
||||
// send spell for homebinding (3286)
|
||||
npc->CastSpell(_player, bindspell, true);
|
||||
|
||||
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, (8+4));
|
||||
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, (8 + 4));
|
||||
data << uint64(npc->GetGUID());
|
||||
data << uint32(bindspell);
|
||||
SendPacket(&data);
|
||||
@@ -514,7 +514,7 @@ void WorldSession::SendBindPoint(Creature* npc)
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
}
|
||||
|
||||
void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS");
|
||||
@@ -586,7 +586,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt8(1, uint8(_player->GetTemporaryUnsummonedPetNumber() ? PET_SAVE_AS_CURRENT : PET_SAVE_NOT_IN_SLOT));
|
||||
|
||||
|
||||
if (PreparedQueryResult _result = CharacterDatabase.AsyncQuery(stmt))
|
||||
{
|
||||
Field* fields = _result->Fetch();
|
||||
@@ -594,7 +594,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
|
||||
data << uint32(fields[0].GetUInt32()); // id
|
||||
data << uint32(fields[1].GetUInt32()); // entry
|
||||
data << uint32(fields[4].GetUInt16()); // level
|
||||
data << fields[8].GetString(); // petname
|
||||
data << fields[8].GetString(); // petname
|
||||
data << uint8(1);
|
||||
++num;
|
||||
}
|
||||
@@ -613,8 +613,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
|
||||
data << uint8(2); // 1 = current, 2/3 = in stable (any from 4, 5, ... create problems with proper show)
|
||||
|
||||
++num;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
data.put<uint8>(wpos, num); // set real data to placeholder
|
||||
@@ -629,7 +628,7 @@ void WorldSession::SendStableResult(uint8 res)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleStablePet(WorldPacket & recvData)
|
||||
void WorldSession::HandleStablePet(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_PET");
|
||||
@@ -704,8 +703,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
|
||||
|
||||
// this slot not free, skip
|
||||
++freeSlot;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_STABLE_RESULT, 1);
|
||||
@@ -728,7 +726,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
|
||||
_player->SetTemporaryUnsummonedPetNumber(0);
|
||||
SendStableResult(STABLE_SUCCESS_STABLE);
|
||||
return;
|
||||
@@ -737,7 +735,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleUnstablePet(WorldPacket & recvData)
|
||||
void WorldSession::HandleUnstablePet(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_UNSTABLE_PET.");
|
||||
@@ -840,7 +838,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleBuyStableSlot(WorldPacket & recvData)
|
||||
void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
|
||||
@@ -861,7 +859,7 @@ void WorldSession::HandleBuyStableSlot(WorldPacket & recvData)
|
||||
|
||||
if (GetPlayer()->m_stableSlots < MAX_PET_STABLES)
|
||||
{
|
||||
StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
|
||||
StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots + 1);
|
||||
if (_player->HasEnoughMoney(SlotPrice->Price))
|
||||
{
|
||||
++GetPlayer()->m_stableSlots;
|
||||
@@ -875,14 +873,14 @@ void WorldSession::HandleBuyStableSlot(WorldPacket & recvData)
|
||||
SendStableResult(STABLE_ERR_STABLE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleStableRevivePet(WorldPacket &/* recvData */)
|
||||
void WorldSession::HandleStableRevivePet(WorldPacket& /* recvData */)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleStableRevivePet: Not implemented");
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleStableSwapPet(WorldPacket & recvData)
|
||||
void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
|
||||
@@ -967,7 +965,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3
|
||||
}
|
||||
|
||||
Pet* pet = _player->GetPet();
|
||||
|
||||
|
||||
// move alive pet to slot or delete dead pet
|
||||
if (pet)
|
||||
_player->RemovePet(pet, pet->IsAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED);
|
||||
@@ -995,7 +993,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3
|
||||
SendStableResult(STABLE_SUCCESS_UNSTABLE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRepairItemOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REPAIR_ITEM");
|
||||
|
||||
@@ -24,26 +24,26 @@
|
||||
|
||||
class LoadPetFromDBQueryHolder : public SQLQueryHolder
|
||||
{
|
||||
private:
|
||||
const uint32 m_petNumber;
|
||||
const bool m_current;
|
||||
const uint32 m_diffTime;
|
||||
const std::string m_actionBar;
|
||||
const uint32 m_savedHealth;
|
||||
const uint32 m_savedMana;
|
||||
private:
|
||||
const uint32 m_petNumber;
|
||||
const bool m_current;
|
||||
const uint32 m_diffTime;
|
||||
const std::string m_actionBar;
|
||||
const uint32 m_savedHealth;
|
||||
const uint32 m_savedMana;
|
||||
|
||||
public:
|
||||
LoadPetFromDBQueryHolder(uint32 petNumber, bool current, uint32 diffTime, std::string actionBar, uint32 health, uint32 mana)
|
||||
: m_petNumber(petNumber), m_current(current), m_diffTime(diffTime), m_actionBar(actionBar),
|
||||
m_savedHealth(health), m_savedMana(mana) { }
|
||||
public:
|
||||
LoadPetFromDBQueryHolder(uint32 petNumber, bool current, uint32 diffTime, std::string actionBar, uint32 health, uint32 mana)
|
||||
: m_petNumber(petNumber), m_current(current), m_diffTime(diffTime), m_actionBar(actionBar),
|
||||
m_savedHealth(health), m_savedMana(mana) { }
|
||||
|
||||
uint32 GetPetNumber() const { return m_petNumber; }
|
||||
uint32 GetDiffTime() const { return m_diffTime; }
|
||||
bool GetCurrent() const { return m_current; }
|
||||
uint32 GetSavedHealth() const { return m_savedHealth; }
|
||||
uint32 GetSavedMana() const { return m_savedMana; }
|
||||
std::string GetActionBar() const { return m_actionBar; }
|
||||
bool Initialize();
|
||||
uint32 GetPetNumber() const { return m_petNumber; }
|
||||
uint32 GetDiffTime() const { return m_diffTime; }
|
||||
bool GetCurrent() const { return m_current; }
|
||||
uint32 GetSavedHealth() const { return m_savedHealth; }
|
||||
uint32 GetSavedMana() const { return m_savedMana; }
|
||||
std::string GetActionBar() const { return m_actionBar; }
|
||||
bool Initialize();
|
||||
};
|
||||
|
||||
bool LoadPetFromDBQueryHolder::Initialize()
|
||||
@@ -105,7 +105,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
|
||||
if (pet_type == HUNTER_PET && savedhealth == 0 && asynchLoadType != PET_LOAD_SUMMON_DEAD_PET)
|
||||
{
|
||||
WorldPacket data(SMSG_CAST_FAILED, 1+4+1+4);
|
||||
WorldPacket data(SMSG_CAST_FAILED, 1 + 4 + 1 + 4);
|
||||
data << uint8(0);
|
||||
data << uint32(883);
|
||||
data << uint8(SPELL_FAILED_TARGETS_DEAD);
|
||||
@@ -181,7 +181,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 0x800); // class = mage
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||
// this enables popup window (pet dismiss, cancel)
|
||||
// this enables popup window (pet dismiss, cancel)
|
||||
break;
|
||||
case HUNTER_PET:
|
||||
pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100); // class = warrior, gender = none, power = focus
|
||||
@@ -189,7 +189,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
pet->SetByteFlag(UNIT_FIELD_BYTES_2, 2, fields[9].GetBool() ? UNIT_CAN_BE_ABANDONED : UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED);
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||
// this enables popup window (pet abandon, cancel)
|
||||
// this enables popup window (pet abandon, cancel)
|
||||
pet->SetMaxPower(POWER_HAPPINESS, pet->GetCreatePowers(POWER_HAPPINESS));
|
||||
pet->SetPower(POWER_HAPPINESS, fields[12].GetUInt32());
|
||||
pet->setPowerType(POWER_FOCUS);
|
||||
@@ -241,7 +241,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
// TODO: pets should be summoned from real cast instead of just faking it?
|
||||
if (summon_spell_id)
|
||||
{
|
||||
WorldPacket data(SMSG_SPELL_GO, (8+8+4+4+2));
|
||||
WorldPacket data(SMSG_SPELL_GO, (8 + 8 + 4 + 4 + 2));
|
||||
data.append(owner->GetPackGUID());
|
||||
data.append(owner->GetPackGUID());
|
||||
data << uint8(0);
|
||||
@@ -352,7 +352,7 @@ void WorldSession::HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder* h
|
||||
return;
|
||||
}
|
||||
|
||||
void WorldSession::HandleDismissCritter(WorldPacket &recvData)
|
||||
void WorldSession::HandleDismissCritter(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid;
|
||||
@@ -373,12 +373,12 @@ void WorldSession::HandleDismissCritter(WorldPacket &recvData)
|
||||
|
||||
if (_player->GetCritterGUID() == pet->GetGUID())
|
||||
{
|
||||
if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->IsSummon())
|
||||
pet->ToTempSummon()->UnSummon();
|
||||
if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->IsSummon())
|
||||
pet->ToTempSummon()->UnSummon();
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetAction(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetAction(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid1;
|
||||
uint32 data;
|
||||
@@ -391,7 +391,7 @@ void WorldSession::HandlePetAction(WorldPacket & recvData)
|
||||
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
|
||||
|
||||
// used also for charmed creature
|
||||
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
|
||||
Unit* pet = ObjectAccessor::GetUnit(*_player, guid1);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
|
||||
#endif
|
||||
@@ -443,7 +443,7 @@ void WorldSession::HandlePetAction(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetStopAttack(WorldPacket &recvData)
|
||||
void WorldSession::HandlePetStopAttack(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid;
|
||||
@@ -479,7 +479,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
if (!charmInfo)
|
||||
{
|
||||
sLog->outError("WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
|
||||
guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId());
|
||||
guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -489,127 +489,127 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
switch (spellid)
|
||||
{
|
||||
case COMMAND_STAY: //flat=1792 //STAY
|
||||
{
|
||||
bool controlledMotion = pet->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) != NULL_MOTION_TYPE;
|
||||
if (!controlledMotion)
|
||||
{
|
||||
pet->StopMovingOnCurrentPos();
|
||||
pet->GetMotionMaster()->Clear(false);
|
||||
pet->GetMotionMaster()->MoveIdle();
|
||||
bool controlledMotion = pet->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) != NULL_MOTION_TYPE;
|
||||
if (!controlledMotion)
|
||||
{
|
||||
pet->StopMovingOnCurrentPos();
|
||||
pet->GetMotionMaster()->Clear(false);
|
||||
pet->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
|
||||
charmInfo->SetCommandState(COMMAND_STAY);
|
||||
charmInfo->SetIsCommandAttack(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
charmInfo->SetIsAtStay(!controlledMotion);
|
||||
charmInfo->SaveStayPosition(controlledMotion);
|
||||
if (pet->ToPet())
|
||||
pet->ToPet()->ClearCastWhenWillAvailable();
|
||||
|
||||
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
break;
|
||||
}
|
||||
|
||||
charmInfo->SetCommandState(COMMAND_STAY);
|
||||
charmInfo->SetIsCommandAttack(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
charmInfo->SetIsAtStay(!controlledMotion);
|
||||
charmInfo->SaveStayPosition(controlledMotion);
|
||||
if (pet->ToPet())
|
||||
pet->ToPet()->ClearCastWhenWillAvailable();
|
||||
|
||||
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
break;
|
||||
}
|
||||
case COMMAND_FOLLOW: //spellid=1792 //FOLLOW
|
||||
{
|
||||
pet->AttackStop();
|
||||
pet->InterruptNonMeleeSpells(false);
|
||||
pet->ClearInPetCombat();
|
||||
pet->GetMotionMaster()->MoveFollow(_player, PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
if (pet->ToPet())
|
||||
pet->ToPet()->ClearCastWhenWillAvailable();
|
||||
charmInfo->SetCommandState(COMMAND_FOLLOW);
|
||||
|
||||
charmInfo->SetIsCommandAttack(false);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsReturning(true);
|
||||
charmInfo->SetIsCommandFollow(true);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->RemoveStayPosition();
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
break;
|
||||
}
|
||||
case COMMAND_ATTACK: //spellid=1792 //ATTACK
|
||||
{
|
||||
// Can't attack if owner is pacified
|
||||
if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY))
|
||||
{
|
||||
//pet->SendPetCastFail(spellid, SPELL_FAILED_PACIFIED);
|
||||
//TODO: Send proper error message to client
|
||||
return;
|
||||
}
|
||||
|
||||
// only place where pet can be player
|
||||
Unit* TargetUnit = ObjectAccessor::GetUnit(*_player, guid2);
|
||||
if (!TargetUnit)
|
||||
return;
|
||||
|
||||
if (Unit* owner = pet->GetOwner())
|
||||
if (!owner->IsValidAttackTarget(TargetUnit))
|
||||
return;
|
||||
|
||||
// pussywizard:
|
||||
if (Creature* creaturePet = pet->ToCreature())
|
||||
if (!creaturePet->_CanDetectFeignDeathOf(TargetUnit) || !creaturePet->CanCreatureAttack(TargetUnit) || creaturePet->isTargetNotAcceptableByMMaps(TargetUnit->GetGUID(), sWorld->GetGameTime(), TargetUnit))
|
||||
return;
|
||||
|
||||
// Not let attack through obstructions
|
||||
bool checkLos = !MMAP::MMapFactory::IsPathfindingEnabled(pet->GetMap()) ||
|
||||
(TargetUnit->GetTypeId() == TYPEID_UNIT && (TargetUnit->ToCreature()->isWorldBoss() || TargetUnit->ToCreature()->IsDungeonBoss()));
|
||||
|
||||
if (checkLos && !pet->IsWithinLOSInMap(TargetUnit))
|
||||
{
|
||||
WorldPacket data(SMSG_CAST_FAILED, 1+4+1);
|
||||
data << uint8(0);
|
||||
data << uint32(7389);
|
||||
data << uint8(SPELL_FAILED_LINE_OF_SIGHT);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
||||
pet->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet->GetVictim() != TargetUnit || (pet->GetVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack()))
|
||||
{
|
||||
pet->AttackStop();
|
||||
pet->InterruptNonMeleeSpells(false);
|
||||
pet->ClearInPetCombat();
|
||||
pet->GetMotionMaster()->MoveFollow(_player, PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
if (pet->ToPet())
|
||||
pet->ToPet()->ClearCastWhenWillAvailable();
|
||||
charmInfo->SetCommandState(COMMAND_FOLLOW);
|
||||
|
||||
if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature()->IsAIEnabled)
|
||||
charmInfo->SetIsCommandAttack(false);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsReturning(true);
|
||||
charmInfo->SetIsCommandFollow(true);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->RemoveStayPosition();
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
break;
|
||||
}
|
||||
case COMMAND_ATTACK: //spellid=1792 //ATTACK
|
||||
{
|
||||
// Can't attack if owner is pacified
|
||||
if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY))
|
||||
{
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
//pet->SendPetCastFail(spellid, SPELL_FAILED_PACIFIED);
|
||||
//TODO: Send proper error message to client
|
||||
return;
|
||||
}
|
||||
|
||||
pet->ToCreature()->AI()->AttackStart(TargetUnit);
|
||||
// only place where pet can be player
|
||||
Unit* TargetUnit = ObjectAccessor::GetUnit(*_player, guid2);
|
||||
if (!TargetUnit)
|
||||
return;
|
||||
|
||||
//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);
|
||||
else
|
||||
if (Unit* owner = pet->GetOwner())
|
||||
if (!owner->IsValidAttackTarget(TargetUnit))
|
||||
return;
|
||||
|
||||
// pussywizard:
|
||||
if (Creature* creaturePet = pet->ToCreature())
|
||||
if (!creaturePet->_CanDetectFeignDeathOf(TargetUnit) || !creaturePet->CanCreatureAttack(TargetUnit) || creaturePet->isTargetNotAcceptableByMMaps(TargetUnit->GetGUID(), sWorld->GetGameTime(), TargetUnit))
|
||||
return;
|
||||
|
||||
// Not let attack through obstructions
|
||||
bool checkLos = !MMAP::MMapFactory::IsPathfindingEnabled(pet->GetMap()) ||
|
||||
(TargetUnit->GetTypeId() == TYPEID_UNIT && (TargetUnit->ToCreature()->isWorldBoss() || TargetUnit->ToCreature()->IsDungeonBoss()));
|
||||
|
||||
if (checkLos && !pet->IsWithinLOSInMap(TargetUnit))
|
||||
{
|
||||
WorldPacket data(SMSG_CAST_FAILED, 1 + 4 + 1);
|
||||
data << uint8(0);
|
||||
data << uint32(7389);
|
||||
data << uint8(SPELL_FAILED_LINE_OF_SIGHT);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
||||
pet->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet->GetVictim() != TargetUnit || (pet->GetVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack()))
|
||||
{
|
||||
pet->AttackStop();
|
||||
|
||||
if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
// 90% chance for pet and 100% chance for charmed creature
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
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);
|
||||
else
|
||||
{
|
||||
// 90% chance for pet and 100% chance for charmed creature
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
}
|
||||
else // charmed player
|
||||
{
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
pet->Attack(TargetUnit, true);
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
}
|
||||
else // charmed player
|
||||
{
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
pet->Attack(TargetUnit, true);
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case COMMAND_ABANDON: // abandon (hunter pet) or dismiss (summoned pet)
|
||||
if (pet->GetCharmerGUID() == GetPlayer()->GetGUID())
|
||||
{
|
||||
@@ -629,7 +629,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
|
||||
pet->setDeathState(CORPSE);
|
||||
}
|
||||
else if (pet->HasUnitTypeMask(UNIT_MASK_MINION|UNIT_MASK_SUMMON|UNIT_MASK_GUARDIAN|UNIT_MASK_CONTROLABLE_GUARDIAN))
|
||||
else if (pet->HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_SUMMON | UNIT_MASK_GUARDIAN | UNIT_MASK_CONTROLABLE_GUARDIAN))
|
||||
{
|
||||
pet->ToTempSummon()->UnSummon();
|
||||
}
|
||||
@@ -661,249 +661,249 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
case ACT_DISABLED: // 0x81 spell (disabled), ignore
|
||||
case ACT_PASSIVE: // 0x01
|
||||
case ACT_ENABLED: // 0xC1 spell
|
||||
{
|
||||
Unit* unit_target = nullptr;
|
||||
|
||||
// do not cast unknown spells
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outError("WORLD: unknown PET spell id %i", spellid);
|
||||
return;
|
||||
}
|
||||
Unit* unit_target = nullptr;
|
||||
|
||||
if (guid2)
|
||||
unit_target = ObjectAccessor::GetUnit(*_player, guid2);
|
||||
else if (!spellInfo->IsPositive())
|
||||
return;
|
||||
|
||||
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENEMY || spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENEMY || spellInfo->Effects[i].TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY)
|
||||
// do not cast unknown spells
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog->outError("WORLD: unknown PET spell id %i", spellid);
|
||||
return;
|
||||
}
|
||||
|
||||
// do not cast not learned spells
|
||||
if (!pet->HasSpell(spellid) || spellInfo->IsPassive())
|
||||
return;
|
||||
|
||||
// Clear the flags as if owner clicked 'attack'. AI will reset them
|
||||
// after AttackStart, even if spell failed
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsCommandAttack(!pet->ToCreature()->HasReactState(REACT_PASSIVE));
|
||||
charmInfo->SetIsReturning(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
|
||||
Spell* spell = new Spell(pet, spellInfo, TRIGGERED_NONE);
|
||||
spell->LoadScripts(); // xinef: load for CheckPetCast
|
||||
|
||||
SpellCastResult result = spell->CheckPetCast(unit_target);
|
||||
|
||||
//auto turn to target unless possessed
|
||||
if (result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->isPossessed() && !pet->IsVehicle())
|
||||
{
|
||||
if (unit_target)
|
||||
{
|
||||
pet->SetInFront(unit_target);
|
||||
if (unit_target->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer(unit_target->ToPlayer());
|
||||
}
|
||||
else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget())
|
||||
{
|
||||
pet->SetInFront(unit_target2);
|
||||
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer(unit_target2->ToPlayer());
|
||||
}
|
||||
if (Unit* powner = pet->GetCharmerOrOwner())
|
||||
if (powner->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer(powner->ToPlayer());
|
||||
|
||||
result = SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
if (result == SPELL_CAST_OK)
|
||||
{
|
||||
pet->ToCreature()->AddSpellCooldown(spellid, 0, 0);
|
||||
|
||||
unit_target = spell->m_targets.GetUnitTarget();
|
||||
|
||||
//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);
|
||||
else
|
||||
{
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
if (unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->isPossessed() && !pet->IsVehicle())
|
||||
if (guid2)
|
||||
unit_target = ObjectAccessor::GetUnit(*_player, guid2);
|
||||
else if (!spellInfo->IsPositive())
|
||||
return;
|
||||
|
||||
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet->GetVictim() != unit_target)
|
||||
if (spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENEMY || spellInfo->Effects[i].TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENEMY || spellInfo->Effects[i].TargetA.GetTarget() == TARGET_DEST_DYNOBJ_ENEMY)
|
||||
return;
|
||||
}
|
||||
|
||||
// do not cast not learned spells
|
||||
if (!pet->HasSpell(spellid) || spellInfo->IsPassive())
|
||||
return;
|
||||
|
||||
// Clear the flags as if owner clicked 'attack'. AI will reset them
|
||||
// after AttackStart, even if spell failed
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsCommandAttack(!pet->ToCreature()->HasReactState(REACT_PASSIVE));
|
||||
charmInfo->SetIsReturning(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
|
||||
Spell* spell = new Spell(pet, spellInfo, TRIGGERED_NONE);
|
||||
spell->LoadScripts(); // xinef: load for CheckPetCast
|
||||
|
||||
SpellCastResult result = spell->CheckPetCast(unit_target);
|
||||
|
||||
//auto turn to target unless possessed
|
||||
if (result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->isPossessed() && !pet->IsVehicle())
|
||||
{
|
||||
if (unit_target)
|
||||
{
|
||||
if (pet->ToCreature()->IsAIEnabled)
|
||||
pet->ToCreature()->AI()->AttackStart(unit_target);
|
||||
pet->SetInFront(unit_target);
|
||||
if (unit_target->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer(unit_target->ToPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
spell->prepare(&(spell->m_targets));
|
||||
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
}
|
||||
else if (pet->ToPet() && (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE))
|
||||
{
|
||||
unit_target = spell->m_targets.GetUnitTarget();
|
||||
bool haspositiveeffect = false;
|
||||
|
||||
if (!unit_target)
|
||||
return;
|
||||
|
||||
// search positive effects for spell
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (spellInfo->_IsPositiveEffect(i, true))
|
||||
else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget())
|
||||
{
|
||||
haspositiveeffect = true;
|
||||
break;
|
||||
pet->SetInFront(unit_target2);
|
||||
if (unit_target2->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer(unit_target2->ToPlayer());
|
||||
}
|
||||
if (Unit* powner = pet->GetCharmerOrOwner())
|
||||
if (powner->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer(powner->ToPlayer());
|
||||
|
||||
result = SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
if (pet->isPossessed() || pet->IsVehicle())
|
||||
Spell::SendCastResult(GetPlayer(), spellInfo, 0, result);
|
||||
else if (GetPlayer()->IsFriendlyTo(unit_target) && !haspositiveeffect)
|
||||
spell->SendPetCastResult(SPELL_FAILED_TARGET_FRIENDLY);
|
||||
else
|
||||
spell->SendPetCastResult(SPELL_FAILED_DONT_REPORT);
|
||||
|
||||
if (!pet->HasSpellCooldown(spellid))
|
||||
if(pet->ToPet())
|
||||
pet->ToPet()->RemoveSpellCooldown(spellid, true);
|
||||
|
||||
spell->finish(false);
|
||||
delete spell;
|
||||
|
||||
if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY))
|
||||
return;
|
||||
|
||||
bool tempspellIsPositive = false;
|
||||
|
||||
if (!GetPlayer()->IsFriendlyTo(unit_target))
|
||||
if (result == SPELL_CAST_OK)
|
||||
{
|
||||
// only place where pet can be player
|
||||
Unit* TargetUnit = ObjectAccessor::GetUnit(*_player, guid2);
|
||||
if (!TargetUnit)
|
||||
pet->ToCreature()->AddSpellCooldown(spellid, 0, 0);
|
||||
|
||||
unit_target = spell->m_targets.GetUnitTarget();
|
||||
|
||||
//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);
|
||||
else
|
||||
{
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
if (unit_target && !GetPlayer()->IsFriendlyTo(unit_target) && !pet->isPossessed() && !pet->IsVehicle())
|
||||
{
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet->GetVictim() != unit_target)
|
||||
{
|
||||
if (pet->ToCreature()->IsAIEnabled)
|
||||
pet->ToCreature()->AI()->AttackStart(unit_target);
|
||||
}
|
||||
}
|
||||
|
||||
spell->prepare(&(spell->m_targets));
|
||||
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
}
|
||||
else if (pet->ToPet() && (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE))
|
||||
{
|
||||
unit_target = spell->m_targets.GetUnitTarget();
|
||||
bool haspositiveeffect = false;
|
||||
|
||||
if (!unit_target)
|
||||
return;
|
||||
|
||||
if (Unit* owner = pet->GetOwner())
|
||||
if (!owner->IsValidAttackTarget(TargetUnit))
|
||||
// search positive effects for spell
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
{
|
||||
if (spellInfo->_IsPositiveEffect(i, true))
|
||||
{
|
||||
haspositiveeffect = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pet->isPossessed() || pet->IsVehicle())
|
||||
Spell::SendCastResult(GetPlayer(), spellInfo, 0, result);
|
||||
else if (GetPlayer()->IsFriendlyTo(unit_target) && !haspositiveeffect)
|
||||
spell->SendPetCastResult(SPELL_FAILED_TARGET_FRIENDLY);
|
||||
else
|
||||
spell->SendPetCastResult(SPELL_FAILED_DONT_REPORT);
|
||||
|
||||
if (!pet->HasSpellCooldown(spellid))
|
||||
if(pet->ToPet())
|
||||
pet->ToPet()->RemoveSpellCooldown(spellid, true);
|
||||
|
||||
spell->finish(false);
|
||||
delete spell;
|
||||
|
||||
if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY))
|
||||
return;
|
||||
|
||||
bool tempspellIsPositive = false;
|
||||
|
||||
if (!GetPlayer()->IsFriendlyTo(unit_target))
|
||||
{
|
||||
// only place where pet can be player
|
||||
Unit* TargetUnit = ObjectAccessor::GetUnit(*_player, guid2);
|
||||
if (!TargetUnit)
|
||||
return;
|
||||
|
||||
pet->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet->GetVictim() != TargetUnit || (pet->GetVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack()))
|
||||
if (Unit* owner = pet->GetOwner())
|
||||
if (!owner->IsValidAttackTarget(TargetUnit))
|
||||
return;
|
||||
|
||||
pet->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
if (pet->GetVictim() != TargetUnit || (pet->GetVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack()))
|
||||
{
|
||||
if (pet->GetVictim())
|
||||
pet->AttackStop();
|
||||
|
||||
if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature() && pet->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
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);
|
||||
else
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
else // charmed player
|
||||
{
|
||||
if (pet->GetVictim() && pet->GetVictim() != TargetUnit)
|
||||
pet->AttackStop();
|
||||
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
pet->Attack(TargetUnit, true);
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
pet->ToPet()->CastWhenWillAvailable(spellid, unit_target, NULL, tempspellIsPositive);
|
||||
}
|
||||
}
|
||||
else if (haspositiveeffect)
|
||||
{
|
||||
if (pet->GetVictim())
|
||||
bool tempspellIsPositive = true;
|
||||
pet->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
Unit* victim = pet->GetVictim();
|
||||
if (victim)
|
||||
{
|
||||
pet->AttackStop();
|
||||
}
|
||||
else
|
||||
victim = nullptr;
|
||||
|
||||
if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature() && pet->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
pet->StopMoving();
|
||||
pet->GetMotionMaster()->Clear();
|
||||
|
||||
charmInfo->SetIsCommandAttack(false);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
pet->ToCreature()->AI()->AttackStart(TargetUnit);
|
||||
pet->GetMotionMaster()->MoveChase(unit_target);
|
||||
|
||||
if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
|
||||
if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != unit_target && urand(0, 100) < 10)
|
||||
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
|
||||
else
|
||||
{
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
pet->ToPet()->CastWhenWillAvailable(spellid, unit_target, victim, tempspellIsPositive);
|
||||
}
|
||||
else // charmed player
|
||||
{
|
||||
if (pet->GetVictim() && pet->GetVictim() != TargetUnit)
|
||||
pet->AttackStop();
|
||||
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
pet->Attack(TargetUnit, true);
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
pet->ToPet()->CastWhenWillAvailable(spellid, unit_target, NULL, tempspellIsPositive);
|
||||
}
|
||||
}
|
||||
else if (haspositiveeffect)
|
||||
else
|
||||
{
|
||||
bool tempspellIsPositive = true;
|
||||
pet->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
// This is true if pet has no target or has target but targets differs.
|
||||
Unit* victim = pet->GetVictim();
|
||||
if (victim)
|
||||
// dont spam alerts
|
||||
if (!charmInfo->GetForcedSpell())
|
||||
{
|
||||
pet->AttackStop();
|
||||
}
|
||||
else
|
||||
victim = nullptr;
|
||||
|
||||
if (pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature() && pet->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
pet->StopMoving();
|
||||
pet->GetMotionMaster()->Clear();
|
||||
|
||||
charmInfo->SetIsCommandAttack(false);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsCommandFollow(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
pet->GetMotionMaster()->MoveChase(unit_target);
|
||||
|
||||
if (pet->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != unit_target && urand(0, 100) < 10)
|
||||
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
|
||||
if (pet->isPossessed() || pet->IsVehicle())
|
||||
Spell::SendCastResult(GetPlayer(), spellInfo, 0, result);
|
||||
else
|
||||
{
|
||||
pet->SendPetAIReaction(guid1);
|
||||
}
|
||||
|
||||
pet->ToPet()->CastWhenWillAvailable(spellid, unit_target, victim, tempspellIsPositive);
|
||||
spell->SendPetCastResult(result);
|
||||
}
|
||||
|
||||
if (!pet->ToCreature()->HasSpellCooldown(spellid))
|
||||
GetPlayer()->SendClearCooldown(spellid, pet);
|
||||
|
||||
spell->finish(false);
|
||||
delete spell;
|
||||
|
||||
// reset specific flags in case of spell fail. AI will reset other flags
|
||||
pet->PetSpellFail(spellInfo, unit_target, result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// dont spam alerts
|
||||
if (!charmInfo->GetForcedSpell())
|
||||
{
|
||||
if (pet->isPossessed() || pet->IsVehicle())
|
||||
Spell::SendCastResult(GetPlayer(), spellInfo, 0, result);
|
||||
else
|
||||
spell->SendPetCastResult(result);
|
||||
}
|
||||
|
||||
if (!pet->ToCreature()->HasSpellCooldown(spellid))
|
||||
GetPlayer()->SendClearCooldown(spellid, pet);
|
||||
|
||||
spell->finish(false);
|
||||
delete spell;
|
||||
|
||||
// reset specific flags in case of spell fail. AI will reset other flags
|
||||
pet->PetSpellFail(spellInfo, unit_target, result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetNameQuery(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetNameQuery. CMSG_PET_NAME_QUERY");
|
||||
@@ -923,7 +923,7 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
|
||||
if (!pet)
|
||||
{
|
||||
WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+1+4+1));
|
||||
WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4 + 1 + 4 + 1));
|
||||
data << uint32(petnumber);
|
||||
data << uint8(0);
|
||||
data << uint32(0);
|
||||
@@ -945,7 +945,7 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
|
||||
else
|
||||
name = pet->GetName();
|
||||
|
||||
WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+name.size()+1));
|
||||
WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4 + 4 + name.size() + 1));
|
||||
data << uint32(petnumber);
|
||||
data << name.c_str();
|
||||
data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP));
|
||||
@@ -989,7 +989,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetSetAction(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetSetAction. CMSG_PET_SET_ACTION");
|
||||
@@ -1065,7 +1065,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recvData)
|
||||
uint32 spell_id_0 = UNIT_ACTION_BUTTON_ACTION(data[0]);
|
||||
UnitActionBarEntry const* actionEntry_1 = charmInfo->GetActionBarEntry(position[1]);
|
||||
if (!actionEntry_1 || spell_id_0 != actionEntry_1->GetAction() ||
|
||||
act_state_0 != actionEntry_1->GetType())
|
||||
act_state_0 != actionEntry_1->GetType())
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1075,7 +1075,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recvData)
|
||||
uint32 spell_id_1 = UNIT_ACTION_BUTTON_ACTION(data[1]);
|
||||
UnitActionBarEntry const* actionEntry_0 = charmInfo->GetActionBarEntry(position[0]);
|
||||
if (!actionEntry_0 || spell_id_1 != actionEntry_0->GetAction() ||
|
||||
act_state_1 != actionEntry_0->GetType())
|
||||
act_state_1 != actionEntry_0->GetType())
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetRename(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDetail("HandlePetRename. CMSG_PET_RENAME");
|
||||
@@ -1135,10 +1135,10 @@ void WorldSession::HandlePetRename(WorldPacket & recvData)
|
||||
recvData >> isdeclined;
|
||||
|
||||
Pet* pet = ObjectAccessor::FindPet(petguid);
|
||||
// check it!
|
||||
if (!pet || !pet->IsPet() || ((Pet*)pet)->getPetType()!= HUNTER_PET ||
|
||||
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||
|
||||
pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo())
|
||||
// check it!
|
||||
if (!pet || !pet->IsPet() || ((Pet*)pet)->getPetType() != HUNTER_PET ||
|
||||
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||
|
||||
pet->GetOwnerGUID() != _player->GetGUID() || !pet->GetCharmInfo())
|
||||
return;
|
||||
|
||||
PetNameInvalidReason res = ObjectMgr::CheckPetName(name);
|
||||
@@ -1191,7 +1191,7 @@ void WorldSession::HandlePetRename(WorldPacket & recvData)
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
|
||||
for (uint8 i = 0; i < 5; i++)
|
||||
stmt->setString(i+1, declinedname.name[i]);
|
||||
stmt->setString(i + 1, declinedname.name[i]);
|
||||
|
||||
trans->Append(stmt);
|
||||
}
|
||||
@@ -1208,7 +1208,7 @@ void WorldSession::HandlePetRename(WorldPacket & recvData)
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetAbandon(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetAbandon(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid; //pet guid
|
||||
@@ -1228,7 +1228,7 @@ void WorldSession::HandlePetAbandon(WorldPacket & recvData)
|
||||
if (pet->GetGUID() == _player->GetPetGUID())
|
||||
{
|
||||
uint32 feelty = pet->GetPower(POWER_HAPPINESS);
|
||||
pet->SetPower(POWER_HAPPINESS, feelty > 50000 ? (feelty-50000) : 0);
|
||||
pet->SetPower(POWER_HAPPINESS, feelty > 50000 ? (feelty - 50000) : 0);
|
||||
}
|
||||
|
||||
_player->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
|
||||
@@ -1334,7 +1334,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
// do not cast not learned spells
|
||||
// do not cast not learned spells
|
||||
if (!caster->HasSpell(spellId) || spellInfo->IsPassive())
|
||||
return;
|
||||
|
||||
@@ -1403,7 +1403,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
caster->AddUnitState(UNIT_STATE_FOLLOW);
|
||||
}
|
||||
|
||||
void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName)
|
||||
void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName* declinedName)
|
||||
{
|
||||
WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1);
|
||||
data << uint32(error);
|
||||
@@ -1419,7 +1419,7 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetLearnTalent(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_LEARN_TALENT");
|
||||
@@ -1433,7 +1433,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket & recvData)
|
||||
_player->SendTalentsInfoData(true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket & recvData)
|
||||
void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS_PET");
|
||||
|
||||
@@ -31,7 +31,7 @@ enum CharterItemIDs
|
||||
ARENA_TEAM_CHARTER_5v5 = 23562
|
||||
};
|
||||
|
||||
void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_BUY");
|
||||
@@ -172,7 +172,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
if (!_player->HasEnoughMoney(cost))
|
||||
{ //player hasn't got enough money
|
||||
{
|
||||
//player hasn't got enough money
|
||||
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, charterid, 0);
|
||||
return;
|
||||
}
|
||||
@@ -260,7 +261,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow);
|
||||
#endif
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+1+signs*12));
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8 + 8 + 4 + 1 + signs * 12));
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << uint64(_player->GetGUID()); // owner guid
|
||||
data << uint32(petitionGuidLow); // guild guid
|
||||
@@ -276,7 +277,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_QUERY"); // ok
|
||||
@@ -305,7 +306,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
|
||||
}
|
||||
|
||||
uint8 type = petition->petitionType;
|
||||
WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4+8+petition->petitionName.size()+1+1+4*12+2+10));
|
||||
WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4 + 8 + petition->petitionName.size() + 1 + 1 + 4 * 12 + 2 + 10));
|
||||
data << uint32(GUID_LOPART(petitionguid)); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid)
|
||||
data << MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); // charter owner guid
|
||||
data << petition->petitionName; // name (guild/arena team)
|
||||
@@ -319,8 +320,8 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint32(type-1);
|
||||
data << uint32(type-1);
|
||||
data << uint32(type - 1);
|
||||
data << uint32(type - 1);
|
||||
data << uint32(type); // bypass client - side limitation, a different value is needed here for each petition
|
||||
}
|
||||
data << uint32(0); // 5
|
||||
@@ -342,7 +343,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_RENAME"); // ok
|
||||
@@ -407,13 +408,13 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str());
|
||||
#endif
|
||||
WorldPacket data(MSG_PETITION_RENAME, (8+newName.size()+1));
|
||||
WorldPacket data(MSG_PETITION_RENAME, (8 + newName.size() + 1));
|
||||
data << uint64(petitionGuid);
|
||||
data << newName;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN"); // ok
|
||||
@@ -509,7 +510,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
|
||||
|
||||
if (found)
|
||||
{
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8 + 8 + 4));
|
||||
data << uint64(petitionGuid);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << (uint32)PETITION_SIGN_ALREADY_SIGNED;
|
||||
@@ -539,7 +540,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId());
|
||||
#endif
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4));
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8 + 8 + 4));
|
||||
data << uint64(petitionGuid);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << uint32(PETITION_SIGN_OK);
|
||||
@@ -557,7 +558,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_DECLINE"); // ok
|
||||
@@ -583,7 +584,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_OFFER_PETITION"); // ok
|
||||
@@ -657,7 +658,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData)
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionguid));
|
||||
uint8 signs = signatures ? signatures->signatureMap.size() : 0;
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8+8+4+signs+signs*12));
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8 + 8 + 4 + signs + signs * 12));
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << uint64(_player->GetGUID()); // owner guid
|
||||
data << uint32(GUID_LOPART(petitionguid)); // guild guid
|
||||
@@ -673,7 +674,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recvData)
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_TURN_IN_PETITION");
|
||||
@@ -761,7 +762,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData)
|
||||
if (type == GUILD_CHARTER_TYPE)
|
||||
requiredSignatures = sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
||||
else
|
||||
requiredSignatures = type-1;
|
||||
requiredSignatures = type - 1;
|
||||
|
||||
// Notify player if signatures are missing
|
||||
if (signs < requiredSignatures)
|
||||
@@ -855,7 +856,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received CMSG_PETITION_SHOWLIST");
|
||||
@@ -878,7 +879,7 @@ void WorldSession::SendPetitionShowList(uint64 guid)
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOWLIST, 8+1+4*6);
|
||||
WorldPacket data(SMSG_PETITION_SHOWLIST, 8 + 1 + 4 * 6);
|
||||
data << guid; // npc guid
|
||||
|
||||
if (creature->IsTabardDesigner())
|
||||
|
||||
@@ -23,7 +23,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
{
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid));
|
||||
|
||||
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8+1+1+1+1+1+10));
|
||||
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 1 + 1 + 1 + 1 + 10));
|
||||
data.appendPackGUID(guid);
|
||||
if (!playerData)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
data << names->name[i];
|
||||
}
|
||||
else*/
|
||||
data << uint8(0); // Name is not declined
|
||||
data << uint8(0); // Name is not declined
|
||||
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -66,21 +66,21 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData)
|
||||
SendNameQueryOpcode(guid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleQueryTimeOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
SendQueryTimeResponse();
|
||||
}
|
||||
|
||||
void WorldSession::SendQueryTimeResponse()
|
||||
{
|
||||
WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4+4);
|
||||
WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4 + 4);
|
||||
data << uint32(time(nullptr));
|
||||
data << uint32(sWorld->GetNextDailyQuestsResetTime() - time(nullptr));
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
/// Only _static_ data is sent in this packet !!!
|
||||
void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 entry;
|
||||
recvData >> entry;
|
||||
@@ -93,7 +93,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recvData)
|
||||
std::string Name, Title;
|
||||
Name = ci->Name;
|
||||
Title = ci->SubName;
|
||||
|
||||
|
||||
LocaleConstant loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recvData)
|
||||
ObjectMgr::GetLocaleString(cl->Title, loc_idx, Title);
|
||||
}
|
||||
}
|
||||
// guess size
|
||||
// guess size
|
||||
WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 100);
|
||||
data << uint32(entry); // creature entry
|
||||
data << Name;
|
||||
@@ -150,7 +150,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
/// Only _static_ data is sent in this packet !!!
|
||||
void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 entry;
|
||||
recvData >> entry;
|
||||
@@ -163,11 +163,11 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recvData)
|
||||
std::string Name;
|
||||
std::string IconName;
|
||||
std::string CastBarCaption;
|
||||
|
||||
|
||||
Name = info->name;
|
||||
IconName = info->IconName;
|
||||
CastBarCaption = info->castBarCaption;
|
||||
|
||||
|
||||
LocaleConstant localeConstant = GetSessionDbLocaleIndex();
|
||||
if (localeConstant >= LOCALE_enUS)
|
||||
if (GameObjectLocale const* gameObjectLocale = sObjectMgr->GetGameObjectLocale(entry))
|
||||
@@ -208,7 +208,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)",
|
||||
GUID_LOPART(guid), entry);
|
||||
GUID_LOPART(guid), entry);
|
||||
#endif
|
||||
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4);
|
||||
data << uint32(entry | 0x80000000);
|
||||
@@ -219,7 +219,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY");
|
||||
@@ -261,7 +261,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/)
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket data(MSG_CORPSE_QUERY, 1+(6*4));
|
||||
WorldPacket data(MSG_CORPSE_QUERY, 1 + (6 * 4));
|
||||
data << uint8(1); // corpse found
|
||||
data << int32(mapid);
|
||||
data << float(x);
|
||||
@@ -272,7 +272,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 textID;
|
||||
uint64 guid;
|
||||
@@ -363,7 +363,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
/// Only _static_ data is sent in this packet !!!
|
||||
void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY");
|
||||
@@ -376,7 +376,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recvData)
|
||||
while (pageID)
|
||||
{
|
||||
PageText const* pageText = sObjectMgr->GetPageText(pageID);
|
||||
// guess size
|
||||
// guess size
|
||||
WorldPacket data(SMSG_PAGE_TEXT_QUERY_RESPONSE, 50);
|
||||
data << pageID;
|
||||
|
||||
@@ -389,12 +389,12 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recvData)
|
||||
else
|
||||
{
|
||||
std::string Text = pageText->Text;
|
||||
|
||||
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
if (PageTextLocale const* player = sObjectMgr->GetPageTextLocale(pageID))
|
||||
ObjectMgr::GetLocaleString(player->Text, loc_idx, Text);
|
||||
|
||||
|
||||
data << Text;
|
||||
data << uint32(pageText->NextPage);
|
||||
pageID = pageText->NextPage;
|
||||
@@ -407,7 +407,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCorpseMapPositionQuery(WorldPacket & recvData)
|
||||
void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY");
|
||||
@@ -416,7 +416,7 @@ void WorldSession::HandleCorpseMapPositionQuery(WorldPacket & recvData)
|
||||
uint32 unk;
|
||||
recvData >> unk;
|
||||
|
||||
WorldPacket data(SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4+4+4+4);
|
||||
WorldPacket data(SMSG_CORPSE_MAP_POSITION_QUERY_RESPONSE, 4 + 4 + 4 + 4);
|
||||
data << float(0);
|
||||
data << float(0);
|
||||
data << float(0);
|
||||
@@ -451,7 +451,7 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recvData)
|
||||
uint16 questSlot = _player->FindQuestSlot(questId);
|
||||
|
||||
if (questSlot != MAX_QUEST_LOG_SIZE)
|
||||
questOk =_player->GetQuestSlotQuestId(questSlot) == questId;
|
||||
questOk = _player->GetQuestSlotQuestId(questSlot) == questId;
|
||||
|
||||
if (questOk)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid;
|
||||
@@ -43,22 +43,22 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recvData)
|
||||
switch (questGiver->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid)));
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid)));
|
||||
#endif
|
||||
if (!questGiver->ToCreature()->IsHostileTo(_player)) // do not show quest status to enemies
|
||||
questStatus = _player->GetQuestDialogStatus(questGiver);
|
||||
break;
|
||||
}
|
||||
if (!questGiver->ToCreature()->IsHostileTo(_player)) // do not show quest status to enemies
|
||||
questStatus = _player->GetQuestDialogStatus(questGiver);
|
||||
break;
|
||||
}
|
||||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid)));
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid)));
|
||||
#endif
|
||||
questStatus = _player->GetQuestDialogStatus(questGiver);
|
||||
break;
|
||||
}
|
||||
questStatus = _player->GetQuestDialogStatus(questGiver);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError("QuestGiver called for unexpected type %u", questGiver->GetTypeId());
|
||||
break;
|
||||
@@ -68,7 +68,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket & recvData)
|
||||
_player->PlayerTalkClass->SendQuestGiverStatus(uint8(questStatus), guid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid;
|
||||
@@ -94,8 +94,8 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recvData)
|
||||
creature->StopMoving();
|
||||
|
||||
#ifdef ELUNA
|
||||
if (sEluna->OnGossipHello(_player, creature))
|
||||
return;
|
||||
if (sEluna->OnGossipHello(_player, creature))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (sScriptMgr->OnGossipHello(_player, creature))
|
||||
@@ -107,7 +107,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recvData)
|
||||
creature->AI()->sGossipHello(_player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
uint32 questId;
|
||||
@@ -118,11 +118,11 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recvData)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
|
||||
#endif
|
||||
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM | TYPEMASK_PLAYER);
|
||||
|
||||
// no or incorrect quest giver
|
||||
if (!object || object == _player || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
|
||||
(object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
|
||||
(object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
|
||||
{
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
_player->SetDivider(0);
|
||||
@@ -199,7 +199,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recvData)
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
uint32 questId;
|
||||
@@ -235,7 +235,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (!_player)
|
||||
return;
|
||||
@@ -250,7 +250,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket & recvData)
|
||||
_player->PlayerTalkClass->SendQuestQueryResponse(quest);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 questId, reward;
|
||||
uint64 guid;
|
||||
@@ -277,7 +277,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
|
||||
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId))
|
||||
{
|
||||
if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) ||
|
||||
(_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
|
||||
(_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
|
||||
{
|
||||
sLog->outError("HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!",
|
||||
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
|
||||
@@ -290,45 +290,45 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
|
||||
switch (object->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
Creature* questgiver = object->ToCreature();
|
||||
if (!sScriptMgr->OnQuestReward(_player, questgiver, quest, reward))
|
||||
{
|
||||
// Send next quest
|
||||
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
|
||||
Creature* questgiver = object->ToCreature();
|
||||
if (!sScriptMgr->OnQuestReward(_player, questgiver, quest, reward))
|
||||
{
|
||||
if (_player->CanAddQuest(nextQuest, false) && _player->CanTakeQuest(nextQuest, false))
|
||||
// Send next quest
|
||||
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
|
||||
{
|
||||
if (nextQuest->IsAutoAccept())
|
||||
_player->AddQuestAndCheckCompletion(nextQuest, object);
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true);
|
||||
if (_player->CanAddQuest(nextQuest, false) && _player->CanTakeQuest(nextQuest, false))
|
||||
{
|
||||
if (nextQuest->IsAutoAccept())
|
||||
_player->AddQuestAndCheckCompletion(nextQuest, object);
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
questgiver->AI()->sQuestReward(_player, quest, reward);
|
||||
questgiver->AI()->sQuestReward(_player, quest, reward);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
GameObject* questGiver = object->ToGameObject();
|
||||
if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, reward))
|
||||
{
|
||||
// Send next quest
|
||||
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
|
||||
GameObject* questGiver = object->ToGameObject();
|
||||
if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, reward))
|
||||
{
|
||||
if (_player->CanAddQuest(nextQuest, false) && _player->CanTakeQuest(nextQuest, false))
|
||||
// Send next quest
|
||||
if (Quest const* nextQuest = _player->GetNextQuest(guid, quest))
|
||||
{
|
||||
if (nextQuest->IsAutoAccept())
|
||||
_player->AddQuestAndCheckCompletion(nextQuest, object);
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true);
|
||||
if (_player->CanAddQuest(nextQuest, false) && _player->CanTakeQuest(nextQuest, false))
|
||||
{
|
||||
if (nextQuest->IsAutoAccept())
|
||||
_player->AddQuestAndCheckCompletion(nextQuest, object);
|
||||
_player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
questGiver->AI()->QuestReward(_player, quest, reward);
|
||||
questGiver->AI()->QuestReward(_player, quest, reward);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 questId;
|
||||
uint64 guid;
|
||||
@@ -508,7 +508,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
|
||||
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
|
||||
{
|
||||
sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
|
||||
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
|
||||
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -592,10 +592,10 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
{
|
||||
// Check if player is in BG
|
||||
if (_player->InBattleground())
|
||||
{
|
||||
_player->GetSession()->SendNotification(LANG_BG_SHARE_QUEST_ERROR);
|
||||
continue;
|
||||
}
|
||||
{
|
||||
_player->GetSession()->SendNotification(LANG_BG_SHARE_QUEST_ERROR);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->GetDivider() != 0)
|
||||
@@ -693,14 +693,14 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleQueryQuestsCompleted(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleQueryQuestsCompleted(WorldPacket& /*recvData*/)
|
||||
{
|
||||
size_t rew_count = _player->GetRewardedQuestCount();
|
||||
|
||||
WorldPacket data(SMSG_QUERY_QUESTS_COMPLETED_RESPONSE, 4 + 4 * rew_count);
|
||||
data << uint32(rew_count);
|
||||
|
||||
const RewardedQuestSet &rewQuests = _player->getRewardedQuests();
|
||||
const RewardedQuestSet& rewQuests = _player->getRewardedQuests();
|
||||
for (RewardedQuestSet::const_iterator itr = rewQuests.begin(); itr != rewQuests.end(); ++itr)
|
||||
data << uint32(*itr);
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
|
||||
else if (target->GetGroup() != _player->GetGroup())
|
||||
error = ERR_REFER_A_FRIEND_NOT_IN_GROUP;
|
||||
|
||||
if (error) {
|
||||
if (error)
|
||||
{
|
||||
WorldPacket data(SMSG_REFER_A_FRIEND_FAILURE, 24);
|
||||
data << uint32(error);
|
||||
if (error == ERR_REFER_A_FRIEND_NOT_IN_GROUP)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void WorldSession::HandleLearnTalentOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleLearnTalentOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 talent_id, requested_rank;
|
||||
recvData >> talent_id >> requested_rank;
|
||||
@@ -50,7 +50,7 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket)
|
||||
recvPacket.rfinish();
|
||||
}
|
||||
|
||||
void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_TALENT_WIPE_CONFIRM");
|
||||
@@ -76,7 +76,7 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recvData)
|
||||
|
||||
if (!(_player->resetTalents()))
|
||||
{
|
||||
WorldPacket data(MSG_TALENT_WIPE_CONFIRM, 8+4); //you have not any talent
|
||||
WorldPacket data(MSG_TALENT_WIPE_CONFIRM, 8 + 4); //you have not any talent
|
||||
data << uint64(0);
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -208,7 +208,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
|
||||
sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!",
|
||||
pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId);
|
||||
pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGameObjectUseOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recvData >> guid;
|
||||
@@ -408,7 +408,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
// Client is resending autoshot cast opcode when other spell is casted during shoot rotation
|
||||
// Skip it to prevent "interrupt" message
|
||||
if (spellInfo->IsAutoRepeatRangedSpell() && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
|
||||
&& _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)
|
||||
&& _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)
|
||||
{
|
||||
recvPacket.rfinish();
|
||||
return;
|
||||
@@ -501,7 +501,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
@@ -537,7 +537,7 @@ void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPacket& /*recvPacket*/
|
||||
_player->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCancelChanneling(WorldPacket & recvData)
|
||||
void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
|
||||
{
|
||||
recvData.read_skip<uint32>(); // spellid, not used
|
||||
|
||||
@@ -572,7 +572,7 @@ void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket)
|
||||
totem->ToTotem()->UnSummon();
|
||||
}
|
||||
|
||||
void WorldSession::HandleSelfResOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::HandleSelfResOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SELF_RES"); // empty opcode
|
||||
@@ -612,7 +612,7 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData)
|
||||
unit->HandleSpellClick(_player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMirrorImageDataRequest(WorldPacket & recvData)
|
||||
void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GET_MIRRORIMAGE_DATA");
|
||||
@@ -675,9 +675,9 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket & recvData)
|
||||
data << uint32(0);
|
||||
else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
|
||||
{
|
||||
uint32 displayInfoId=item->GetTemplate()->DisplayInfoID;
|
||||
uint32 displayInfoId = item->GetTemplate()->DisplayInfoID;
|
||||
|
||||
sScriptMgr->OnGlobalMirrorImageDisplayItem(item,displayInfoId);
|
||||
sScriptMgr->OnGlobalMirrorImageDisplayItem(item, displayInfoId);
|
||||
|
||||
data << uint32(displayInfoId);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "UpdateMask.h"
|
||||
#include "WaypointMovementGenerator.h"
|
||||
|
||||
void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
|
||||
@@ -58,7 +58,7 @@ void WorldSession::SendTaxiStatus(uint64 guid)
|
||||
#endif
|
||||
}
|
||||
|
||||
void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket & recvData)
|
||||
void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
|
||||
@@ -166,7 +166,7 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recvData)
|
||||
void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
|
||||
@@ -228,7 +228,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
|
||||
recvData.read_skip<uint32>(); // spline id
|
||||
}
|
||||
|
||||
void WorldSession::HandleActivateTaxiOpcode(WorldPacket & recvData)
|
||||
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI");
|
||||
|
||||
@@ -108,7 +108,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
std::string message;
|
||||
recv_data >> message;
|
||||
@@ -130,7 +130,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()))
|
||||
{
|
||||
@@ -145,7 +145,7 @@ void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
SendQueryTimeResponse();
|
||||
|
||||
@@ -160,7 +160,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/)
|
||||
sTicketMgr->SendTicket(this, nullptr);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
// Note: This only disables the ticket UI at client side and is not fully reliable
|
||||
// are we sure this is a uint32? Should ask Zor
|
||||
|
||||
@@ -25,17 +25,17 @@ void WorldSession::SendTradeStatus(TradeStatus status)
|
||||
switch (status)
|
||||
{
|
||||
case TRADE_STATUS_BEGIN_TRADE:
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4+8);
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 8);
|
||||
data << uint32(status);
|
||||
data << uint64(0);
|
||||
break;
|
||||
case TRADE_STATUS_OPEN_WINDOW:
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4+4);
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 4);
|
||||
data << uint32(status);
|
||||
data << uint32(0); // added in 2.4.0
|
||||
break;
|
||||
case TRADE_STATUS_CLOSE_WINDOW:
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4+4+1+4);
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 4 + 1 + 4);
|
||||
data << uint32(status);
|
||||
data << uint32(0);
|
||||
data << uint8(0);
|
||||
@@ -43,7 +43,7 @@ void WorldSession::SendTradeStatus(TradeStatus status)
|
||||
break;
|
||||
case TRADE_STATUS_ONLY_CONJURED:
|
||||
case TRADE_STATUS_NOT_ELIGIBLE:
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4+1);
|
||||
data.Initialize(SMSG_TRADE_STATUS, 4 + 1);
|
||||
data << uint32(status);
|
||||
data << uint8(0);
|
||||
break;
|
||||
@@ -76,7 +76,7 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
|
||||
{
|
||||
TradeData* view_trade = trader_data ? _player->GetTradeData()->GetTraderData() : _player->GetTradeData();
|
||||
|
||||
WorldPacket data(SMSG_TRADE_STATUS_EXTENDED, 1+4+4+4+4+4+7*(1+4+4+4+4+8+4+4+4+4+8+4+4+4+4+4+4));
|
||||
WorldPacket data(SMSG_TRADE_STATUS_EXTENDED, 1 + 4 + 4 + 4 + 4 + 4 + 7 * (1 + 4 + 4 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 8 + 4 + 4 + 4 + 4 + 4 + 4));
|
||||
data << uint8(trader_data); // 1 means traders data, 0 means own
|
||||
data << uint32(0); // added in 2.4.0, this value must be equal to value from TRADE_STATUS_OPEN_WINDOW status packet (different value for different players to block multiple trades?)
|
||||
data << uint32(TRADE_SLOT_COUNT); // trade slots count/number?, = next field in most cases
|
||||
@@ -93,22 +93,22 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
|
||||
data << uint32(item->GetTemplate()->ItemId); // entry
|
||||
data << uint32(item->GetTemplate()->DisplayInfoID);// display id
|
||||
data << uint32(item->GetCount()); // stack count
|
||||
// wrapped: hide stats but show giftcreator name
|
||||
// wrapped: hide stats but show giftcreator name
|
||||
data << uint32(item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED) ? 1 : 0);
|
||||
data << uint64(item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR));
|
||||
// perm. enchantment and gems
|
||||
// perm. enchantment and gems
|
||||
data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT));
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
|
||||
// creator
|
||||
// creator
|
||||
data << uint64(item->GetUInt64Value(ITEM_FIELD_CREATOR));
|
||||
data << uint32(item->GetSpellCharges()); // charges
|
||||
data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
|
||||
data << uint32(item->GetItemRandomPropertyId());// random properties id
|
||||
data << uint32(item->GetTemplate()->LockID); // lock id
|
||||
// max durability
|
||||
// max durability
|
||||
data << uint32(item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY));
|
||||
// durability
|
||||
// durability
|
||||
data << uint32(item->GetUInt32Value(ITEM_FIELD_DURABILITY));
|
||||
}
|
||||
else
|
||||
@@ -149,7 +149,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
|
||||
// adjust time (depends on /played)
|
||||
if (myItems[i]->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
|
||||
myItems[i]->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, trader->GetTotalPlayedTime()-(_player->GetTotalPlayedTime()-myItems[i]->GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)));
|
||||
myItems[i]->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, trader->GetTotalPlayedTime() - (_player->GetTotalPlayedTime() - myItems[i]->GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)));
|
||||
// store
|
||||
trader->MoveItemToInventory(traderDst, myItems[i], true, true);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
|
||||
// adjust time (depends on /played)
|
||||
if (hisItems[i]->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
|
||||
hisItems[i]->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, _player->GetTotalPlayedTime()-(trader->GetTotalPlayedTime()-hisItems[i]->GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)));
|
||||
hisItems[i]->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, _player->GetTotalPlayedTime() - (trader->GetTotalPlayedTime() - hisItems[i]->GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)));
|
||||
// store
|
||||
_player->MoveItemToInventory(playerDst, hisItems[i], true, true);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
|
||||
//==============================================================
|
||||
|
||||
static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *myItems, Item* *hisItems)
|
||||
static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item * *myItems, Item * *hisItems)
|
||||
{
|
||||
myTrade->SetInAcceptProcess(true);
|
||||
hisTrade->SetInAcceptProcess(true);
|
||||
@@ -231,7 +231,7 @@ static void clearAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade)
|
||||
hisTrade->SetInAcceptProcess(false);
|
||||
}
|
||||
|
||||
static void clearAcceptTradeMode(Item* *myItems, Item* *hisItems)
|
||||
static void clearAcceptTradeMode(Item * *myItems, Item * *hisItems)
|
||||
{
|
||||
// clear 'in-trade' flag
|
||||
for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
|
||||
@@ -344,7 +344,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
Item* castItem = my_trade->GetSpellCastItem();
|
||||
|
||||
if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
|
||||
(my_trade->HasSpellCastItem() && !castItem))
|
||||
(my_trade->HasSpellCastItem() && !castItem))
|
||||
{
|
||||
clearAcceptTradeMode(my_trade, his_trade);
|
||||
clearAcceptTradeMode(myItems, hisItems);
|
||||
@@ -462,11 +462,11 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
// execute trade: 2. store
|
||||
moveItems(myItems, hisItems);
|
||||
|
||||
if( my_trade->GetMoney() >= 10*GOLD )
|
||||
if( my_trade->GetMoney() >= 10 * GOLD )
|
||||
{
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<TRADE>\", NOW())", GetAccountId(), _player->GetGUIDLow(), _player->GetName().c_str(), GetRemoteAddress().c_str(), trader->GetSession()->GetAccountId(), trader->GetName().c_str(), my_trade->GetMoney());
|
||||
}
|
||||
if( his_trade->GetMoney() >= 10*GOLD )
|
||||
if( his_trade->GetMoney() >= 10 * GOLD )
|
||||
{
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<TRADE>\", NOW())", trader->GetSession()->GetAccountId(), trader->GetGUIDLow(), trader->GetName().c_str(), trader->GetSession()->GetRemoteAddress().c_str(), GetAccountId(), _player->GetName().c_str(), his_trade->GetMoney());
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
||||
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
|
||||
void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
|
||||
@@ -47,7 +47,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recvData)
|
||||
_player->ExitVehicle();
|
||||
}
|
||||
|
||||
void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
|
||||
void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE");
|
||||
@@ -65,7 +65,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
sLog->outError("HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.",
|
||||
recvData.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
|
||||
recvData.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,60 +78,60 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recvData)
|
||||
GetPlayer()->ChangeSeat(-1, true);
|
||||
break;
|
||||
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
|
||||
{
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
|
||||
// pussywizard:
|
||||
if (vehicle_base->GetGUID() != guid)
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
|
||||
// pussywizard:
|
||||
if (vehicle_base->GetGUID() != guid)
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
MovementInfo movementInfo;
|
||||
movementInfo.guid = guid;
|
||||
ReadMovementInfo(recvData, &movementInfo);
|
||||
vehicle_base->m_movementInfo = movementInfo;
|
||||
|
||||
uint64 accessory; // accessory guid
|
||||
recvData.readPackGUID(accessory);
|
||||
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
|
||||
if (!accessory)
|
||||
GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next
|
||||
else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), accessory))
|
||||
{
|
||||
if (Vehicle* vehicle = vehUnit->GetVehicleKit())
|
||||
if (vehicle->HasEmptySeat(seatId))
|
||||
vehUnit->HandleSpellClick(GetPlayer(), seatId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
MovementInfo movementInfo;
|
||||
movementInfo.guid = guid;
|
||||
ReadMovementInfo(recvData, &movementInfo);
|
||||
vehicle_base->m_movementInfo = movementInfo;
|
||||
|
||||
uint64 accessory; // accessory guid
|
||||
recvData.readPackGUID(accessory);
|
||||
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
|
||||
if (!accessory)
|
||||
GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next
|
||||
else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), accessory))
|
||||
{
|
||||
if (Vehicle* vehicle = vehUnit->GetVehicleKit())
|
||||
if (vehicle->HasEmptySeat(seatId))
|
||||
vehUnit->HandleSpellClick(GetPlayer(), seatId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
|
||||
{
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
{
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
|
||||
if (vehicle_base->GetGUID() == guid)
|
||||
GetPlayer()->ChangeSeat(seatId);
|
||||
else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), guid))
|
||||
if (Vehicle* vehicle = vehUnit->GetVehicleKit())
|
||||
if (vehicle->HasEmptySeat(seatId))
|
||||
vehUnit->HandleSpellClick(GetPlayer(), seatId);
|
||||
break;
|
||||
}
|
||||
if (vehicle_base->GetGUID() == guid)
|
||||
GetPlayer()->ChangeSeat(seatId);
|
||||
else if (Unit* vehUnit = ObjectAccessor::GetUnit(*GetPlayer(), guid))
|
||||
if (Vehicle* vehicle = vehUnit->GetVehicleKit())
|
||||
if (vehicle->HasEmptySeat(seatId))
|
||||
vehUnit->HandleSpellClick(GetPlayer(), seatId);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
|
||||
void WorldSession::HandleEnterPlayerVehicle(WorldPacket& data)
|
||||
{
|
||||
// Read guid
|
||||
uint64 guid;
|
||||
@@ -153,7 +153,7 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleEjectPassenger(WorldPacket &data)
|
||||
void WorldSession::HandleEjectPassenger(WorldPacket& data)
|
||||
{
|
||||
Vehicle* vehicle = _player->GetVehicleKit();
|
||||
if (!vehicle)
|
||||
@@ -215,7 +215,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
|
||||
sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
}
|
||||
else
|
||||
sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD , GetPlayer()->GetGUIDLow(), guid);
|
||||
sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||
@@ -232,7 +232,7 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||
GetPlayer()->ExitVehicle();
|
||||
else
|
||||
sLog->outError("Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
|
||||
GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags);
|
||||
GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user