diff options
Diffstat (limited to 'src')
73 files changed, 1817 insertions, 1725 deletions
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index dad2a5eb488..c2eb744d3f1 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -589,6 +589,8 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS: case ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL: case ACHIEVEMENT_CRITERIA_TYPE_LOSE_DUEL: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED: case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN: case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS: @@ -1063,7 +1065,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(miscvalue1 != achievementCriteria->equip_item.itemID) continue; - SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE); + SetCriteriaProgress(achievementCriteria, 1); break; case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT: // miscvalue1 = go entry @@ -1202,8 +1204,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM: - case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: - case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_TOTAL: break; // Not implemented yet :( } @@ -1360,6 +1360,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED: + case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALTH: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_SPELLPOWER: case ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_ARMOR: @@ -1536,7 +1538,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement) return; // titles - if(uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE?0:1]) + if(uint32 titleId = reward->titleId[GetPlayer()->GetTeam() == HORDE ? 0 : 1]) { if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(titleId)) GetPlayer()->SetTitle(titleEntry); diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index f195ccc93c3..ab3319ce2ad 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -28,7 +28,7 @@ #include "World.h" #include "SocialMgr.h" -void WorldSession::HandleInspectArenaStatsOpcode(WorldPacket & recv_data) +void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recv_data) { sLog.outDebug("MSG_INSPECT_ARENA_TEAMS"); @@ -36,7 +36,7 @@ void WorldSession::HandleInspectArenaStatsOpcode(WorldPacket & recv_data) uint64 guid; recv_data >> guid; - sLog.outDebug("Inspect Arena stats " I64FMTD, guid); + sLog.outDebug("Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); if(Player *plr = objmgr.GetPlayer(guid)) { @@ -84,9 +84,9 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket & recv_data) arenateam->Roster(this); } -void WorldSession::HandleArenaTeamAddMemberOpcode(WorldPacket & recv_data) +void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recv_data) { - sLog.outDebug("CMSG_ARENA_TEAM_ADD_MEMBER"); + sLog.outDebug("CMSG_ARENA_TEAM_INVITE"); CHECK_PACKET_SIZE(recv_data, 4+1); @@ -164,9 +164,9 @@ void WorldSession::HandleArenaTeamAddMemberOpcode(WorldPacket & recv_data) sLog.outDebug("WORLD: Sent SMSG_ARENA_TEAM_INVITE"); } -void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recv_data*/) { - sLog.outDebug("CMSG_ARENA_TEAM_INVITE_ACCEPT"); // empty opcode + sLog.outDebug("CMSG_ARENA_TEAM_ACCEPT"); // empty opcode ArenaTeam *at = objmgr.GetArenaTeamById(_player->GetArenaTeamIdInvited()); if(!at) @@ -196,9 +196,9 @@ void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/ at->BroadcastPacket(&data); } -void WorldSession::HandleArenaTeamInviteDeclineOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket & /*recv_data*/) { - sLog.outDebug("CMSG_ARENA_TEAM_INVITE_DECLINE"); // empty opcode + sLog.outDebug("CMSG_ARENA_TEAM_DECLINE"); // empty opcode _player->SetArenaTeamIdInvited(0); // no more invited } @@ -263,9 +263,9 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket & recv_data) delete at; } -void WorldSession::HandleArenaTeamRemoveFromTeamOpcode(WorldPacket & recv_data) +void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket & recv_data) { - sLog.outDebug("CMSG_ARENA_TEAM_REMOVE_FROM_TEAM"); + sLog.outDebug("CMSG_ARENA_TEAM_REMOVE"); CHECK_PACKET_SIZE(recv_data, 4+1); @@ -309,9 +309,9 @@ void WorldSession::HandleArenaTeamRemoveFromTeamOpcode(WorldPacket & recv_data) at->BroadcastPacket(&data); } -void WorldSession::HandleArenaTeamPromoteToCaptainOpcode(WorldPacket & recv_data) +void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket & recv_data) { - sLog.outDebug("CMSG_ARENA_TEAM_PROMOTE_TO_CAPTAIN"); + sLog.outDebug("CMSG_ARENA_TEAM_LEADER"); CHECK_PACKET_SIZE(recv_data, 4+1); diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 921db551508..1a70162de11 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -615,7 +615,8 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() ); - //sLog.outDebug("Auctionhouse search guid: " I64FMTD ", list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", guid, listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); + //sLog.outDebug("Auctionhouse search (GUID: %u TypeId: %u)", , list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", + // GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) ); uint32 count = 0; diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index bfb24b15e7a..1b3a96f7584 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -682,6 +682,6 @@ void AuctionEntry::SaveToDB() const { //No SQL injection (no strings) CharacterDatabase.PExecute("INSERT INTO auctionhouse (id,auctioneerguid,itemguid,item_template,itemowner,buyoutprice,time,buyguid,lastbid,startbid,deposit) " - "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" I64FMTD "', '%u', '%u', '%u', '%u')", + "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u')", Id, auctioneer, item_guidlow, item_template, owner, buyout, (uint64)expire_time, bidder, bid, startbid, deposit); } diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index a995157786f..118c9769480 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -486,7 +486,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet) if (plr) plr->GetSession()->SendPacket(packet); else - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); } } @@ -498,7 +498,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player * if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -530,7 +530,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -553,7 +553,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -573,7 +573,7 @@ void BattleGround::YellToAll(Creature* creature, const char* text, uint32 langua Player *plr = objmgr.GetPlayer(itr->first); if(!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player " UI64FMTD " not found!", itr->first); continue; } creature->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,text,language,creature->GetName(),itr->first); @@ -590,7 +590,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -615,7 +615,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, if (!plr) { - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } @@ -714,7 +714,7 @@ void BattleGround::EndBattleGround(uint32 winner) else loser_arena_team->OfflineMemberLost(itr->first, winner_rating); } - sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first); + sLog.outError("BattleGround: Player (GUID: %u) not found!", GUID_LOPART(itr->first)); continue; } diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 7e6063a09d2..385ec3d9bc1 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -152,7 +152,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); if (!plr) { - sLog.outError("BattleGroundEY: Player " I64FMTD " not found!", m_PlayersNearPoint[EY_POINTS_MAX][j]); + sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); ++j; continue; } @@ -192,7 +192,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[i][j]); if (!plr) { - sLog.outError("BattleGroundEY: Player " I64FMTD " not found!", m_PlayersNearPoint[i][j]); + sLog.outError("BattleGroundEY: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); //move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 903f7888813..b22c47e75d5 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -34,13 +34,13 @@ #include "ArenaTeam.h" #include "Language.h" -void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBattlemasterHelloOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; recv_data >> guid; - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid); + sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid),GuidHigh2TypeId(GUID_HIPART(guid))); Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) @@ -71,7 +71,7 @@ void WorldSession::SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgType SendPacket( &data ); } -void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) +void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 8+4+4+1); @@ -95,7 +95,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); - sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from: " I64FMT, guid); + sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); // can do this, since it's battleground, not arena BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0); @@ -272,7 +272,7 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv } } -void WorldSession::HandleBattleGroundPVPlogdataOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandlePVPLogDataOpcode( WorldPacket & /*recv_data*/ ) { sLog.outDebug( "WORLD: Recvd MSG_PVP_LOG_DATA Message"); @@ -287,7 +287,7 @@ void WorldSession::HandleBattleGroundPVPlogdataOpcode( WorldPacket & /*recv_data sLog.outDebug( "WORLD: Sent MSG_PVP_LOG_DATA Message"); } -void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data ) +void WorldSession::HandleBattlefieldListOpcode( WorldPacket &recv_data ) { CHECK_PACKET_SIZE(recv_data, 4); @@ -308,7 +308,7 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data ) SendPacket( &data ); } -void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) +void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) { CHECK_PACKET_SIZE(recv_data, 1+1+4+2+1); @@ -504,7 +504,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) } } -void WorldSession::HandleBattleGroundLeaveOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket & /*recv_data*/ ) { //CHECK_PACKET_SIZE(recv_data, 1+1+4+2); @@ -632,7 +632,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data ) bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); } -void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) +void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 8+1+1+1); @@ -673,7 +673,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) arenatype = ARENA_TYPE_5v5; break; default: - sLog.outError("Unknown arena slot %u at HandleBattleGroundArenaJoin()", arenaslot); + sLog.outError("Unknown arena slot %u at HandleBattlemasterJoinArena()", arenaslot); return; } @@ -793,7 +793,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId), arenatype, isRated, arenaRating); } -void WorldSession::HandleBattleGroundReportAFK( WorldPacket & recv_data ) +void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 8); @@ -803,11 +803,11 @@ void WorldSession::HandleBattleGroundReportAFK( WorldPacket & recv_data ) if (!reportedPlayer) { - sLog.outDebug("WorldSession::HandleBattleGroundReportAFK: player not found"); + sLog.outDebug("WorldSession::HandleReportPvPAFK: player not found"); return; } - sLog.outDebug("WorldSession::HandleBattleGroundReportAFK: %s reported %s", _player->GetName(), reportedPlayer->GetName()); + sLog.outDebug("WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName(), reportedPlayer->GetName()); reportedPlayer->ReportedAfkBy(_player); } diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index f0f801c3060..561953cbf02 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -1190,7 +1190,7 @@ void BattleGroundMgr::Update(uint32 diff) { DistributeArenaPoints(); m_NextAutoDistributionTime = time(NULL) + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); - CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"I64FMTD"'", m_NextAutoDistributionTime); + CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '"UI64FMTD"'", m_NextAutoDistributionTime); } m_AutoDistributionTimeChecker = 600000; // check 10 minutes } @@ -1761,7 +1761,7 @@ void BattleGroundMgr::InitAutomaticArenaPointDistribution() { sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now."); m_NextAutoDistributionTime = time(NULL) + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS); - CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"I64FMTD"')", m_NextAutoDistributionTime); + CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('"UI64FMTD"')", m_NextAutoDistributionTime); } else { diff --git a/src/game/ChannelHandler.cpp b/src/game/ChannelHandler.cpp index 9b06693c589..7359c104751 100644 --- a/src/game/ChannelHandler.cpp +++ b/src/game/ChannelHandler.cpp @@ -25,7 +25,7 @@ INSTANTIATE_SINGLETON_1( AllianceChannelMgr ); INSTANTIATE_SINGLETON_1( HordeChannelMgr ); -void WorldSession::HandleChannelJoin(WorldPacket& recvPacket) +void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); @@ -50,7 +50,7 @@ void WorldSession::HandleChannelJoin(WorldPacket& recvPacket) chn->Join(_player->GetGUID(), pass.c_str()); } -void WorldSession::HandleChannelLeave(WorldPacket& recvPacket) +void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); @@ -315,7 +315,7 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) chn->UnBan(_player->GetGUID(), otp.c_str()); } -void WorldSession::HandleChannelAnnounce(WorldPacket& recvPacket) +void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); @@ -341,7 +341,7 @@ void WorldSession::HandleChannelModerate(WorldPacket& recvPacket) chn->Moderate(_player->GetGUID()); } -void WorldSession::HandleChannelRosterQuery(WorldPacket &recvPacket) +void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); @@ -354,7 +354,7 @@ void WorldSession::HandleChannelRosterQuery(WorldPacket &recvPacket) chn->List(_player); } -void WorldSession::HandleChannelInfoQuery(WorldPacket &recvPacket) +void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); @@ -375,7 +375,7 @@ void WorldSession::HandleChannelInfoQuery(WorldPacket &recvPacket) } } -void WorldSession::HandleChannelJoinNotify(WorldPacket &recvPacket) +void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) { sLog.outDebug("Opcode %u", recvPacket.GetOpcode()); //recvPacket.hexlike(); diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 75e5611ea07..0f4cb5ee0b5 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -74,7 +74,7 @@ bool LoginQueryHolder::Initialize() res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT button,action,type,misc FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid)); - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" I64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid),(uint64)time(NULL)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid)); @@ -942,7 +942,7 @@ void WorldSession::HandleTutorialReset( WorldPacket & /*recv_data*/ ) GetPlayer()->SetTutorialInt( i, 0x00000000 ); } -void WorldSession::HandleSetWatchedFactionIndexOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data) { CHECK_PACKET_SIZE(recv_data,4); @@ -952,7 +952,7 @@ void WorldSession::HandleSetWatchedFactionIndexOpcode(WorldPacket & recv_data) GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact); } -void WorldSession::HandleSetWatchedFactionInactiveOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data) { CHECK_PACKET_SIZE(recv_data,4+1); @@ -964,19 +964,19 @@ void WorldSession::HandleSetWatchedFactionInactiveOpcode(WorldPacket & recv_data _player->GetReputationMgr().SetInactive(replistid, inactive); } -void WorldSession::HandleToggleHelmOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleShowingHelmOpcode( WorldPacket & /*recv_data*/ ) { - DEBUG_LOG("CMSG_TOGGLE_HELM for %s", _player->GetName()); + DEBUG_LOG("CMSG_SHOWING_HELM for %s", _player->GetName()); _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); } -void WorldSession::HandleToggleCloakOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleShowingCloakOpcode( WorldPacket & /*recv_data*/ ) { - DEBUG_LOG("CMSG_TOGGLE_CLOAK for %s", _player->GetName()); + DEBUG_LOG("CMSG_SHOWING_CLOAK for %s", _player->GetName()); _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); } -void WorldSession::HandleChangePlayerNameOpcode(WorldPacket& recv_data) +void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) { CHECK_PACKET_SIZE(recv_data, 8+1); @@ -1059,7 +1059,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uin session->SendPacket(&data); } -void WorldSession::HandleDeclinedPlayerNameOpcode(WorldPacket& recv_data) +void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data) { uint64 guid; diff --git a/src/game/Chat.h b/src/game/Chat.h index 725217ef69b..0b8b076969b 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -597,6 +597,7 @@ class ChatHandler bool HandleBanInfoHelper(uint32 accountid, char const* accountname); bool HandleUnBanHelper(BanMode mode,char const* args); void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel); + void HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id); void SetSentErrorMessage(bool val){ sentErrorMessage = val;}; private: diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 0627f6419fb..72d7f0212d5 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2139,10 +2139,33 @@ bool Creature::LoadCreaturesAddon(bool reload) Mount(cainfo->mount); if (cainfo->bytes1 != 0) - SetUInt32Value(UNIT_FIELD_BYTES_1, cainfo->bytes1); + { + // 0 StandState + // 1 FreeTalentPoints Pet only, so always 0 for default creature + // 2 StandFlags + // 3 StandMiscFlags + + SetByteValue(UNIT_FIELD_BYTES_1, 0, uint8(cainfo->bytes1 & 0xFF)); + //SetByteValue(UNIT_FIELD_BYTES_1, 1, uint8((cainfo->bytes1 >> 8) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_1, 1, 0); + SetByteValue(UNIT_FIELD_BYTES_1, 2, uint8((cainfo->bytes1 >> 16) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_1, 3, uint8((cainfo->bytes1 >> 24) & 0xFF)); + } if (cainfo->bytes2 != 0) - SetUInt32Value(UNIT_FIELD_BYTES_2, cainfo->bytes2); + { + // 0 SheathState + // 1 Bytes2Flags + // 2 UnitRename Pet only, so always 0 for default creature + // 3 ShapeshiftForm Must be determined/set by shapeshift spell/aura + + SetByteValue(UNIT_FIELD_BYTES_2, 0, uint8(cainfo->bytes2 & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_2, 1, uint8((cainfo->bytes2 >> 8) & 0xFF)); + //SetByteValue(UNIT_FIELD_BYTES_2, 2, uint8((cainfo->bytes2 >> 16) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_2, 2, 0); + //SetByteValue(UNIT_FIELD_BYTES_2, 3, uint8((cainfo->bytes2 >> 24) & 0xFF)); + SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); + } if (cainfo->emote != 0) SetUInt32Value(UNIT_NPC_EMOTESTATE, cainfo->emote); diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 267ceb5f7de..e2c51f40804 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -413,12 +413,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 } case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: { - if (action.morph.creatireId || action.morph.modelId) + if (action.morph.creatureId || action.morph.modelId) { //set model based on entry from creature_template - if (action.morph.creatireId) + if (action.morph.creatureId) { - if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatireId)) + if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatureId)) { //use default display if (ci->Modelid_A1) @@ -520,12 +520,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 Creature* pCreature = NULL; if (action.summon.duration) - pCreature = m_creature->SummonCreature(action.summon.creatured, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration); + pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration); else - pCreature = m_creature->SummonCreature(action.summon.creatured, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); if (!pCreature) - sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatured, EventId, m_creature->GetEntry()); + sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry()); else if (action.summon.target != TARGET_T_SELF && target) pCreature->AI()->AttackStart(target); break; @@ -577,15 +577,27 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 MeleeEnabled = action.auto_attack.state != 0; break; case ACTION_T_COMBAT_MOVEMENT: + // ignore no affect case + if(CombatMovementEnabled==(action.combat_movement.state!=0)) + return; + CombatMovementEnabled = action.combat_movement.state != 0; //Allow movement (create new targeted movement gen only if idle) if (CombatMovementEnabled) { - m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); + if(action.combat_movement.melee && m_creature->isInCombat()) + if(Unit* victim = m_creature->getVictim()) + m_creature->SendMeleeAttackStart(victim); + + m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle); } else { + if(action.combat_movement.melee && m_creature->isInCombat()) + if(Unit* victim = m_creature->getVictim()) + m_creature->SendMeleeAttackStop(victim); + m_creature->GetMotionMaster()->MoveIdle(); } break; @@ -605,7 +617,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 sLog.outErrorDb( "CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, m_creature->GetEntry()); Phase = MAX_PHASE-1; } - else + else Phase = new_phase; break; diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index eb9a2a2dff5..d94ceeeac18 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -199,73 +199,73 @@ struct CreatureEventAI_Action // ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3 struct { - uint32 creatireId; // set one from fields (or 0 for both to demorph) + uint32 creatureId; // set one from fields (or 0 for both to demorph) uint32 modelId; } morph; // ACTION_T_SOUND = 4 - struct + struct { uint32 soundId; } sound; // ACTION_T_EMOTE = 5 - struct + struct { uint32 emoteId; } emote; // ACTION_T_RANDOM_SOUND = 9 - struct + struct { int32 soundId1; // (-1 in any field means no output if randomed that field) int32 soundId2; int32 soundId3; } random_sound; // ACTION_T_RANDOM_EMOTE = 10 - struct + struct { int32 emoteId1; // (-1 in any field means no output if randomed that field) int32 emoteId2; int32 emoteId3; } random_emote; // ACTION_T_CAST = 11 - struct + struct { uint32 spellId; uint32 target; uint32 castFlags; } cast; // ACTION_T_SUMMON = 12 - struct + struct { - uint32 creatured; + uint32 creatureId; uint32 target; uint32 duration; } summon; // ACTION_T_THREAT_SINGLE_PCT = 13 - struct + struct { int32 percent; uint32 target; } threat_single_pct; // ACTION_T_THREAT_ALL_PCT = 14 - struct + struct { int32 percent; } threat_all_pct; // ACTION_T_QUEST_EVENT = 15 - struct + struct { uint32 questId; uint32 target; } quest_event; // ACTION_T_CAST_EVENT = 16 - struct + struct { uint32 creatureId; uint32 spellId; uint32 target; } cast_event; // ACTION_T_SET_UNIT_FIELD = 17 - struct + struct { uint32 field; uint32 value; @@ -273,94 +273,95 @@ struct CreatureEventAI_Action } set_unit_field; // ACTION_T_SET_UNIT_FLAG = 18, // value provided mask bits that will be set // ACTION_T_REMOVE_UNIT_FLAG = 19, // value provided mask bits that will be clear - struct + struct { uint32 value; uint32 target; } unit_flag; // ACTION_T_AUTO_ATTACK = 20 - struct + struct { uint32 state; // 0 = stop attack, anything else means continue attacking } auto_attack; // ACTION_T_COMBAT_MOVEMENT = 21 - struct + struct { uint32 state; // 0 = stop combat based movement, anything else continue attacking + uint32 melee; // if set: at stop send melee combat stop if in combat, use for terminate melee fighting state for switch to ranged } combat_movement; // ACTION_T_SET_PHASE = 22 - struct + struct { uint32 phase; } set_phase; // ACTION_T_INC_PHASE = 23 - struct + struct { int32 step; } set_inc_phase; // ACTION_T_QUEST_EVENT_ALL = 26 - struct + struct { uint32 questId; } quest_event_all; // ACTION_T_CAST_EVENT_ALL = 27 - struct + struct { uint32 creatureId; uint32 spellId; } cast_event_all; // ACTION_T_REMOVEAURASFROMSPELL = 28 - struct + struct { uint32 target; uint32 spellId; } remove_aura; // ACTION_T_RANGED_MOVEMENT = 29 - struct + struct { uint32 distance; int32 angle; } ranged_movement; // ACTION_T_RANDOM_PHASE = 30 - struct + struct { uint32 phase1; uint32 phase2; uint32 phase3; } random_phase; // ACTION_T_RANDOM_PHASE_RANGE = 31 - struct + struct { uint32 phaseMin; uint32 phaseMax; } random_phase_range; // ACTION_T_SUMMON_ID = 32 - struct + struct { uint32 creatureId; uint32 target; uint32 spawnId; } summon_id; // ACTION_T_KILLED_MONSTER = 33 - struct + struct { uint32 creatureId; uint32 target; } killed_monster; // ACTION_T_SET_INST_DATA = 34 - struct + struct { uint32 field; uint32 value; } set_inst_data; // ACTION_T_SET_INST_DATA64 = 35 - struct + struct { uint32 field; uint32 target; } set_inst_data64; // ACTION_T_UPDATE_TEMPLATE = 36 - struct + struct { uint32 creatureId; uint32 team; @@ -508,7 +509,7 @@ struct CreatureEventAI_Event } receive_emote; // RAW - struct + struct { uint32 param1; uint32 param2; diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp index af79ae5189c..0a6fb8bdb59 100644 --- a/src/game/CreatureEventAIMgr.cpp +++ b/src/game/CreatureEventAIMgr.cpp @@ -438,19 +438,19 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } break; case ACTION_T_MORPH_TO_ENTRY_OR_MODEL: - if (action.morph.creatireId !=0 || action.morph.modelId !=0) + if (action.morph.creatureId !=0 || action.morph.modelId !=0) { - if (action.morph.creatireId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.morph.creatireId)) + if (action.morph.creatureId && !sCreatureStorage.LookupEntry<CreatureInfo>(action.morph.creatureId)) { - sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatireId); - action.morph.creatireId = 0; + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, action.morph.creatureId); + action.morph.creatureId = 0; } if (action.morph.modelId) { - if (action.morph.creatireId) + if (action.morph.creatureId) { - sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId,action.morph.creatireId); + sLog.outErrorDb("CreatureEventAI: Event %u Action %u have unused ModelId %u with also set creature id %u.", i, j+1, action.morph.modelId,action.morph.creatureId); action.morph.modelId = 0; } else if (!sCreatureDisplayInfoStore.LookupEntry(action.morph.modelId)) @@ -512,8 +512,8 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() break; } case ACTION_T_SUMMON: - if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon.creatured)) - sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatured); + if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.summon.creatureId)) + sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.summon.creatureId); if (action.summon.target >= TARGET_T_END) sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index 50a543859cd..c35048548bb 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -756,7 +756,8 @@ struct CurrencyTypesEntry { //uint32 ID; // 0 not used uint32 ItemId; // 1 used as real index - uint32 BitIndex; // 2 bit index in PLAYER_FIELD_KNOWN_CURRENCIES (1 << (index-1)) + //uint32 Category; // 2 may be category + uint32 BitIndex; // 3 bit index in PLAYER_FIELD_KNOWN_CURRENCIES (1 << (index-1)) }; struct DurabilityCostsEntry @@ -1038,8 +1039,8 @@ struct ItemLimitCategoryEntry uint32 ID; // 0 Id //char* name[16] // 1-16 m_name_lang // 17 name flags - uint32 maxCount; // max allowed equipped as item or in gem slot - //uint32 unk; // 1 for prismatic gems only... + uint32 maxCount; // 18, max allowed equipped as item or in gem slot + //uint32 unk; // 19, 1 for gems only... }; struct ItemRandomPropertiesEntry @@ -1276,7 +1277,7 @@ struct SkillLineEntry uint32 spellIcon; // 37 m_spellIconID //char* alternateVerb[16]; // 38-53 m_alternateVerb_lang // 54 string flags - // 55 m_canLink + uint32 canLink; // 55 m_canLink (prof. with recipes }; struct SkillLineAbilityEntry diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h index 9187cc85e3d..cf3d723a364 100644 --- a/src/game/DBCfmt.h +++ b/src/game/DBCfmt.h @@ -81,7 +81,7 @@ const char QuestSortEntryfmt[]="nxxxxxxxxxxxxxxxxx"; const char RandomPropertiesPointsfmt[]="niiiiiiiiiiiiiii"; const char ScalingStatDistributionfmt[]="niiiiiiiiiiiiiiiiiiiii"; const char ScalingStatValuesfmt[]="iniiiiiiiiiiiiiiiii"; -const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxx"; +const char SkillLinefmt[]="nixssssssssssssssssxxxxxxxxxxxxxxxxxxixxxxxxxxxxxxxxxxxi"; const char SkillLineAbilityfmt[]="niiiixxiiiiixx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SpellCastTimefmt[]="nixx"; diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 018b20e0b3f..0d70a4f5cde 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -1618,7 +1618,7 @@ void GameEventMgr::SaveWorldEventStateToDB(uint16 event_id) CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("DELETE FROM game_event_save WHERE event_id = '%u'",event_id); if(mGameEvent[event_id].nextstart) - CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u',FROM_UNIXTIME("I64FMTD"))",event_id,mGameEvent[event_id].state,(uint64)(mGameEvent[event_id].nextstart)); + CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u',FROM_UNIXTIME("UI64FMTD"))",event_id,mGameEvent[event_id].state,(uint64)(mGameEvent[event_id].nextstart)); else CharacterDatabase.PExecute("INSERT INTO game_event_save (event_id, state, next_start) VALUES ('%u','%u','0000-00-00 00:00:00')",event_id,mGameEvent[event_id].state); CharacterDatabase.CommitTransaction(); diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 3493bec6bb0..e1693e0bdbe 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -105,6 +105,7 @@ struct GameObjectInfo uint32 openTextID; //14 can be used to replace castBarCaption? uint32 groupLootRules; //15 } chest; + //4 GAMEOBJECT_TYPE_BINDER - empty //5 GAMEOBJECT_TYPE_GENERIC struct { @@ -207,6 +208,7 @@ struct GameObjectInfo uint32 eventID; //2 uint32 openTextID; //3 can be used to replace castBarCaption? } camera; + //14 GAMEOBJECT_TYPE_MAPOBJECT - empty //15 GAMEOBJECT_TYPE_MO_TRANSPORT struct { @@ -218,6 +220,7 @@ struct GameObjectInfo uint32 transportPhysics; //5 uint32 mapID; //6 } moTransport; + //16 GAMEOBJECT_TYPE_DUELFLAG - empty //17 GAMEOBJECT_TYPE_FISHINGNODE struct { @@ -236,6 +239,7 @@ struct GameObjectInfo uint32 castersGrouped; //6 uint32 ritualNoTargetCheck; //7 } summoningRitual; + //19 GAMEOBJECT_TYPE_MAILBOX - empty //20 GAMEOBJECT_TYPE_AUCTIONHOUSE struct { @@ -358,7 +362,8 @@ struct GameObjectInfo uint32 unk9; uint32 destroyedDisplayId; //10 } destructibleBuilding; - //34 GAMEOBJECT_TYPE_TRAPDOOR + //34 GAMEOBJECT_TYPE_GUILDBANK - empty + //35 GAMEOBJECT_TYPE_TRAPDOOR struct { uint32 whenToPause; // 0 @@ -367,7 +372,7 @@ struct GameObjectInfo } trapDoor; // not use for specific field access (only for output with loop by all filed), also this determinate max union size - struct // GAMEOBJECT_TYPE_SPELLCASTER + struct { uint32 data[24]; } raw; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 42c4c66ef01..5191f4e9313 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -152,7 +152,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) Quest const* pQuest = objmgr.GetQuestTemplate(questID); data << uint32(questID); - data << uint32( qItem.m_qIcon ); + data << uint32(qItem.m_qIcon); data << uint32(pSession->GetPlayer()->GetQuestLevel(pQuest)); std::string Title = pQuest->GetTitle(); diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 7eb5c326142..a1bee4df650 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -996,10 +996,10 @@ namespace Trinity return false; if(!u->CanAssistTo(i_obj,i_enemy)) return false; - + if(!i_obj->IsWithinDistInMap(u, i_range)) return false; - + if(!i_obj->IsWithinLOSInMap(u)) return false; diff --git a/src/game/Group.cpp b/src/game/Group.cpp index d2c17680e52..a9d06091619 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -107,7 +107,7 @@ bool Group::Create(const uint64 &guid, const char * name) CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid)); CharacterDatabase.PExecute("INSERT INTO groups(leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty) " - "VALUES('%u','%u','%u','%u','%u','%u','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','" I64FMTD "','%u','%u')", + "VALUES('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u')", GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod), GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), m_difficulty); } diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index cd7004f5a07..1a156070815 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -276,7 +276,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) SendPartyResult(PARTY_OP_LEAVE, "", PARTY_RESULT_NOT_IN_YOUR_PARTY); } -void WorldSession::HandleGroupUninviteNameOpcode(WorldPacket & recv_data) +void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) { CHECK_PACKET_SIZE(recv_data,1); @@ -290,7 +290,7 @@ void WorldSession::HandleGroupUninviteNameOpcode(WorldPacket & recv_data) // can't uninvite yourself if(GetPlayer()->GetName() == membername) { - sLog.outError("WorldSession::HandleGroupUninviteNameOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); + sLog.outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); return; } @@ -342,7 +342,7 @@ void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data ) group->ChangeLeader(guid); } -void WorldSession::HandleGroupLeaveOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ ) { if(!GetPlayer()->GetGroup()) return; @@ -409,6 +409,16 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data ) // everything's fine, do it group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, Choise); + + switch (Choise) + { + case 1: + GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1); + break; + case 2: + GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1); + break; + } } void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data) @@ -464,7 +474,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleRaidIconTargetOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRaidTargetUpdateOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,1); @@ -497,7 +507,7 @@ void WorldSession::HandleRaidIconTargetOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleRaidConvertOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ ) { Group *group = GetPlayer()->GetGroup(); if(!group) @@ -558,7 +568,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ) group->ChangeMembersGroup(movedPlayer, groupNr); } -void WorldSession::HandleGroupAssistantOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+1); @@ -580,9 +590,10 @@ void WorldSession::HandleGroupAssistantOpcode( WorldPacket & recv_data ) group->SetAssistant(guid, (flag==0?false:true)); } -void WorldSession::HandleGroupPromoteOpcode( WorldPacket & recv_data ) +void WorldSession::HandlePartyAssignmentOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 1+1+8); + sLog.outDebug("MSG_PARTY_ASSIGNMENT"); Group *group = GetPlayer()->GetGroup(); if(!group) @@ -642,7 +653,7 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleRaidReadyCheckFinishOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRaidReadyCheckFinishedOpcode( WorldPacket & /*recv_data*/ ) { //Group* group = GetPlayer()->GetGroup(); //if(!group) @@ -919,11 +930,11 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data ) sLog.outDebug( "WORLD: got CMSG_GROUP_CANCEL." ); }*/ -void WorldSession::HandleGroupPassOnLootOpcode( WorldPacket & recv_data ) +void WorldSession::HandleOptOutOfLootOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 4); - sLog.outDebug("WORLD: Received CMSG_GROUP_PASS_ON_LOOT"); + sLog.outDebug("WORLD: Received CMSG_OPT_OUT_OF_LOOT"); uint32 unkn; recv_data >> unkn; diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index fdc39d5d851..205277be2d0 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -84,7 +84,7 @@ bool Guild::create(Player* leader, std::string gname) CharacterDatabase.PExecute("DELETE FROM guild_rank WHERE guildid='%u'", Id); CharacterDatabase.PExecute("DELETE FROM guild_member WHERE guildid='%u'", Id); CharacterDatabase.PExecute("INSERT INTO guild (guildid,name,leaderguid,info,motd,createdate,EmblemStyle,EmblemColor,BorderStyle,BorderColor,BackgroundColor,BankMoney) " - "VALUES('%u','%s','%u', '%s', '%s', NOW(),'%u','%u','%u','%u','%u','" I64FMTD "')", + "VALUES('%u','%s','%u', '%s', '%s', NOW(),'%u','%u','%u','%u','%u','" UI64FMTD "')", Id, gname.c_str(), GUID_LOPART(leaderGuid), dbGINFO.c_str(), dbMOTD.c_str(), EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, guildbank_money); CharacterDatabase.CommitTransaction(); @@ -934,7 +934,7 @@ void Guild::LogGuildEvent(uint8 EventType, uint32 PlayerGuid1, uint32 PlayerGuid // Add entry to map m_GuildEventlog.push_back(NewEvent); // Add new eventlog entry into DB - CharacterDatabase.PExecute("INSERT INTO guild_eventlog (guildid, LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','" I64FMTD "')", + CharacterDatabase.PExecute("INSERT INTO guild_eventlog (guildid, LogGuid, EventType, PlayerGuid1, PlayerGuid2, NewRank, TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "')", Id, NewEvent->LogGuid, uint32(NewEvent->EventType), NewEvent->PlayerGuid1, NewEvent->PlayerGuid2, uint32(NewEvent->NewRank), NewEvent->TimeStamp); } @@ -1317,7 +1317,7 @@ void Guild::SetBankMoney(int64 money) money = 0; guildbank_money = money; - CharacterDatabase.PExecute("UPDATE guild SET BankMoney='" I64FMTD "' WHERE guildid='%u'", money, Id); + CharacterDatabase.PExecute("UPDATE guild SET BankMoney='" UI64FMTD "' WHERE guildid='%u'", money, Id); } // ************************************************* @@ -1683,7 +1683,7 @@ void Guild::LogBankEvent(uint8 LogEntry, uint8 TabId, uint32 PlayerGuidLow, uint } m_GuildBankEventLog_Item[TabId].push_back(NewEvent); } - CharacterDatabase.PExecute("INSERT INTO guild_bank_eventlog (guildid,LogGuid,LogEntry,TabId,PlayerGuid,ItemOrMoney,ItemStackCount,DestTabId,TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','%u','%u','" I64FMTD "')", + CharacterDatabase.PExecute("INSERT INTO guild_bank_eventlog (guildid,LogGuid,LogEntry,TabId,PlayerGuid,ItemOrMoney,ItemStackCount,DestTabId,TimeStamp) VALUES ('%u','%u','%u','%u','%u','%u','%u','%u','" UI64FMTD "')", Id, NewEvent->LogGuid, uint32(NewEvent->LogEntry), uint32(TabId), NewEvent->PlayerGuid, NewEvent->ItemOrMoney, uint32(NewEvent->ItemStackCount), uint32(NewEvent->DestTabId), NewEvent->TimeStamp); } diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 4055497c730..ffb6d26676f 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -740,7 +740,7 @@ void WorldSession::SendGuildCommandResult(uint32 typecmd, const std::string& str //sLog.outDebug("WORLD: Sent (SMSG_GUILD_COMMAND_RESULT)"); } -void WorldSession::HandleGuildChangeInfoOpcode(WorldPacket& recvPacket) +void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) { CHECK_PACKET_SIZE(recvPacket, 1); @@ -766,7 +766,7 @@ void WorldSession::HandleGuildChangeInfoOpcode(WorldPacket& recvPacket) guild->SetGINFO(GINFO); } -void WorldSession::HandleGuildSaveEmblemOpcode(WorldPacket& recvPacket) +void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) { CHECK_PACKET_SIZE(recvPacket, 8+4+4+4+4+4); @@ -787,7 +787,7 @@ void WorldSession::HandleGuildSaveEmblemOpcode(WorldPacket& recvPacket) { //"That's not an emblem vendor!" SendSaveGuildEmblem(ERR_GUILDEMBLEM_INVALIDVENDOR); - sLog.outDebug("WORLD: HandleGuildSaveEmblemOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(vendorGuid)); + sLog.outDebug("WORLD: HandleSaveGuildEmblemOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(vendorGuid)); return; } @@ -832,7 +832,7 @@ void WorldSession::HandleGuildSaveEmblemOpcode(WorldPacket& recvPacket) guild->Query(this); } -void WorldSession::HandleGuildEventLogOpcode(WorldPacket& /* recvPacket */) +void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) { // empty sLog.outDebug("WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)"); @@ -851,7 +851,7 @@ void WorldSession::HandleGuildEventLogOpcode(WorldPacket& /* recvPacket */) /****** GUILD BANK *******/ -void WorldSession::HandleGuildBankGetMoneyAmount( WorldPacket & /* recv_data */ ) +void WorldSession::HandleGuildBankMoneyWithdrawn( WorldPacket & /* recv_data */ ) { sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)"); //recv_data.hexlike(); @@ -867,7 +867,7 @@ void WorldSession::HandleGuildBankGetMoneyAmount( WorldPacket & /* recv_data */ pGuild->SendMoneyInfo(this, GetPlayer()->GetGUIDLow()); } -void WorldSession::HandleGuildBankGetRights( WorldPacket& /* recv_data */ ) +void WorldSession::HandleGuildPermissions( WorldPacket& /* recv_data */ ) { sLog.outDebug("WORLD: Received (MSG_GUILD_PERMISSIONS)"); @@ -897,7 +897,7 @@ void WorldSession::HandleGuildBankGetRights( WorldPacket& /* recv_data */ ) } /* Called when clicking on Guild bank gameobject */ -void WorldSession::HandleGuildBankQuery( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankerActivate( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANKER_ACTIVATE)"); CHECK_PACKET_SIZE(recv_data,8+1); @@ -921,7 +921,7 @@ void WorldSession::HandleGuildBankQuery( WorldPacket & recv_data ) } /* Called when opening guild bank tab only (first one) */ -void WorldSession::HandleGuildBankTabColon( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankQueryTab( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)"); CHECK_PACKET_SIZE(recv_data,8+1+1); @@ -947,7 +947,7 @@ void WorldSession::HandleGuildBankTabColon( WorldPacket & recv_data ) pGuild->DisplayGuildBankContent(this, TabId); } -void WorldSession::HandleGuildBankDeposit( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankDepositMoney( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_DEPOSIT_MONEY)"); CHECK_PACKET_SIZE(recv_data,8+4); @@ -995,7 +995,7 @@ void WorldSession::HandleGuildBankDeposit( WorldPacket & recv_data ) pGuild->DisplayGuildBankMoneyUpdate(); } -void WorldSession::HandleGuildBankWithdraw( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankWithdrawMoney( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_WITHDRAW_MONEY)"); CHECK_PACKET_SIZE(recv_data,8+4); @@ -1045,7 +1045,7 @@ void WorldSession::HandleGuildBankWithdraw( WorldPacket & recv_data ) pGuild->DisplayGuildBankMoneyUpdate(); } -void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_SWAP_ITEMS)"); //recv_data.hexlike(); @@ -1599,7 +1599,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data ) pGuild->DisplayGuildBankTabsInfo(this); } -void WorldSession::HandleGuildBankModifyTab( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankUpdateTab( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (CMSG_GUILD_BANK_UPDATE_TAB)"); //recv_data.hexlike(); @@ -1636,7 +1636,7 @@ void WorldSession::HandleGuildBankModifyTab( WorldPacket & recv_data ) pGuild->DisplayGuildBankContent(this, TabId); } -void WorldSession::HandleGuildBankLog( WorldPacket & recv_data ) +void WorldSession::HandleGuildBankLogQuery( WorldPacket & recv_data ) { sLog.outDebug("WORLD: Received (MSG_GUILD_BANK_LOG_QUERY)"); CHECK_PACKET_SIZE(recv_data, 1); @@ -1655,7 +1655,7 @@ void WorldSession::HandleGuildBankLog( WorldPacket & recv_data ) pGuild->DisplayGuildBankLogs(this, TabId); } -void WorldSession::HandleGuildBankTabText(WorldPacket &recv_data) +void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data) { sLog.outDebug("WORLD: Received MSG_QUERY_GUILD_BANK_TEXT"); CHECK_PACKET_SIZE(recv_data, 1); @@ -1674,7 +1674,7 @@ void WorldSession::HandleGuildBankTabText(WorldPacket &recv_data) pGuild->SendGuildBankTabText(this, TabId); } -void WorldSession::HandleGuildBankSetTabText(WorldPacket &recv_data) +void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data) { sLog.outDebug("WORLD: Received CMSG_SET_GUILD_BANK_TEXT"); CHECK_PACKET_SIZE(recv_data, 1+1); diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp index b12c001cf56..14d5951615d 100644 --- a/src/game/InstanceSaveMgr.cpp +++ b/src/game/InstanceSaveMgr.cpp @@ -135,7 +135,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId) { // save the resettime for normal instances only when they get unloaded if(time_t resettime = itr->second->GetResetTimeForDB()) - CharacterDatabase.PExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId); + CharacterDatabase.PExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", (uint64)resettime, InstanceId); delete itr->second; m_instanceSaveById.erase(itr); } @@ -173,7 +173,7 @@ void InstanceSave::SaveToDB() } } - CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"I64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str()); + CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '"UI64FMTD"', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str()); } time_t InstanceSave::GetResetTimeForDB() @@ -403,7 +403,7 @@ void InstanceSaveManager::LoadResetTimes() ResetTimeMapType::iterator itr = InstResetTime.find(instance); if(itr != InstResetTime.end() && itr->second.second != resettime) { - CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"I64FMTD"' WHERE id = '%u'", uint64(resettime), instance); + CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance); itr->second.second = resettime; } } @@ -438,7 +438,7 @@ void InstanceSaveManager::LoadResetTimes() uint64 oldresettime = fields[1].GetUInt64(); uint64 newresettime = (oldresettime / DAY) * DAY + diff; if(oldresettime != newresettime) - CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%u'", newresettime, mapid); + CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", newresettime, mapid); m_resetTimeByMapId[mapid] = newresettime; } while(result->NextRow()); @@ -447,7 +447,7 @@ void InstanceSaveManager::LoadResetTimes() // clean expired instances, references to them will be deleted in CleanupInstances // must be done before calculating new reset times - _DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map WHERE (instance.resettime < '"I64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"I64FMTD"')", (uint64)now, (uint64)now); + _DelHelper(CharacterDatabase, "id, map, difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)now, (uint64)now); // calculate new global reset times for expired instances and those that have never been reset yet // add the global reset times to the priority queue @@ -467,7 +467,7 @@ void InstanceSaveManager::LoadResetTimes() { // initialize the reset time t = today + period + diff; - CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','"I64FMTD"')", i, (uint64)t); + CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','"UI64FMTD"')", i, (uint64)t); } if(t < now) @@ -476,7 +476,7 @@ void InstanceSaveManager::LoadResetTimes() // calculate the next reset time t = (t / DAY) * DAY; t += ((today - t) / period + 1) * period + diff; - CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%u'", (uint64)t, i); + CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u'", (uint64)t, i); } m_resetTimeByMapId[temp->map] = t; @@ -619,7 +619,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, bool warn, uint32 timeLe uint32 period = temp->reset_delay * DAY; uint64 next_reset = ((now + timeLeft + MINUTE) / DAY * DAY) + period + diff; // update it in the DB - CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"I64FMTD"' WHERE mapid = '%d'", next_reset, mapid); + CharacterDatabase.PExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%d'", next_reset, mapid); } MapInstanced::InstancedMaps &instMaps = ((MapInstanced*)map)->GetInstancedMaps(); diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 3be61c80ea2..ddb28e0288d 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -1009,7 +1009,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) return; } else - sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item)", itemid); + sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item)", itemid); } void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) @@ -1321,7 +1321,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) _player->ToggleMetaGemsActive(slot, true); //turn on all metagems (except for target item) } -void WorldSession::HandleCancelTempItemEnchantmentOpcode(WorldPacket& recv_data) +void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data) { sLog.outDebug("WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT"); diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 64c57d2c7fc..68e275ed963 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -123,6 +123,7 @@ enum ITEM_FLAGS enum BAG_FAMILY_MASK { + BAG_FAMILY_MASK_NONE = 0x00000000, BAG_FAMILY_MASK_ARROWS = 0x00000001, BAG_FAMILY_MASK_BULLETS = 0x00000002, BAG_FAMILY_MASK_SOUL_SHARDS = 0x00000004, @@ -564,7 +565,7 @@ struct ItemPrototype uint32 MaxDurability; uint32 Area; // id from AreaTable.dbc uint32 Map; // id from Map.dbc - uint32 BagFamily; // bit string (1 << id from ItemBagFamily.dbc) + uint32 BagFamily; // bit mask (1 << id from ItemBagFamily.dbc) uint32 TotemCategory; // id from TotemCategory.dbc _Socket Socket[MAX_ITEM_PROTO_SOCKETS]; uint32 socketBonus; // id from SpellItemEnchantment.dbc diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp index 85c196a9346..6df5fc77532 100644 --- a/src/game/LFGHandler.cpp +++ b/src/game/LFGHandler.cpp @@ -142,9 +142,9 @@ static void AttemptAddMore(Player* _player) } } -void WorldSession::HandleLfgAutoJoinOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfgSetAutoJoinOpcode( WorldPacket & /*recv_data*/ ) { - sLog.outDebug("CMSG_SET_LFG_AUTO_JOIN"); + sLog.outDebug("CMSG_LFG_SET_AUTOJOIN"); LookingForGroup_auto_join = true; if(!_player) // needed because STATUS_AUTHED @@ -153,15 +153,15 @@ void WorldSession::HandleLfgAutoJoinOpcode( WorldPacket & /*recv_data*/ ) AttemptJoin(_player); } -void WorldSession::HandleLfgCancelAutoJoinOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfgClearAutoJoinOpcode( WorldPacket & /*recv_data*/ ) { - sLog.outDebug("CMSG_UNSET_LFG_AUTO_JOIN"); + sLog.outDebug("CMSG_LFG_CLEAR_AUTOJOIN"); LookingForGroup_auto_join = false; } -void WorldSession::HandleLfmAutoAddMembersOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfmSetAutoFillOpcode( WorldPacket & /*recv_data*/ ) { - sLog.outDebug("CMSG_SET_LFM_AUTOADD"); + sLog.outDebug("CMSG_LFM_SET_AUTOFILL"); LookingForGroup_auto_add = true; if(!_player) // needed because STATUS_AUTHED @@ -170,15 +170,16 @@ void WorldSession::HandleLfmAutoAddMembersOpcode( WorldPacket & /*recv_data*/ ) AttemptAddMore(_player); } -void WorldSession::HandleLfmCancelAutoAddmembersOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleLfmClearAutoFillOpcode( WorldPacket & /*recv_data*/ ) { - sLog.outDebug("CMSG_UNSET_LFM_AUTOADD"); + sLog.outDebug("CMSG_LFM_CLEAR_AUTOFILL"); LookingForGroup_auto_add = false; } void WorldSession::HandleLfgClearOpcode( WorldPacket & /*recv_data */ ) { - sLog.outDebug("CMSG_LOOKING_FOR_GROUP_CLEAR"); + // empty packet + sLog.outDebug("CMSG_CLEAR_LOOKING_FOR_GROUP"); for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) _player->m_lookingForGroup.slots[i].Clear(); @@ -187,14 +188,15 @@ void WorldSession::HandleLfgClearOpcode( WorldPacket & /*recv_data */ ) _player->LeaveLFGChannel(); } -void WorldSession::HandleLfmSetNoneOpcode( WorldPacket & /*recv_data */) +void WorldSession::HandleLfmClearOpcode( WorldPacket & /*recv_data */) { - sLog.outDebug("CMSG_SET_LOOKING_FOR_NONE"); + // empty packet + sLog.outDebug("CMSG_CLEAR_LOOKING_FOR_MORE"); _player->m_lookingForGroup.more.Clear(); } -void WorldSession::HandleLfmSetOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,4); @@ -216,11 +218,11 @@ void WorldSession::HandleLfmSetOpcode( WorldPacket & recv_data ) SendLfgResult(type, entry, 1); } -void WorldSession::HandleLfgSetCommentOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetLfgCommentOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,1); + CHECK_PACKET_SIZE(recv_data, 1); - sLog.outDebug("CMSG_SET_COMMENTARY"); + sLog.outDebug("CMSG_SET_LFG_COMMENT"); //recv_data.hexlike(); std::string comment; @@ -232,7 +234,7 @@ void WorldSession::HandleLfgSetCommentOpcode( WorldPacket & recv_data ) void WorldSession::HandleLookingForGroup(WorldPacket& recv_data) { - CHECK_PACKET_SIZE(recv_data,4+4+4); + CHECK_PACKET_SIZE(recv_data, 4+4+4); sLog.outDebug("MSG_LOOKING_FOR_GROUP"); //recv_data.hexlike(); diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 054040fb708..0cde7dc5eb8 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1052,7 +1052,7 @@ bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args) uint64 titles = 0; - sscanf((char*)args, I64FMTD, &titles); + sscanf((char*)args, UI64FMTD, &titles); Player *chr = getSelectedPlayer(); if (!chr) @@ -1068,7 +1068,7 @@ bool ChatHandler::HandleModifyKnownTitlesCommand(const char* args) uint64 titles2 = titles; - for(int i=1; i < sCharTitlesStore.GetNumRows(); ++i) + for(int i = 1; i < sCharTitlesStore.GetNumRows(); ++i) if(CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i)) titles2 &= ~(uint64(1) << tEntry->bit_index); @@ -2418,7 +2418,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args) extractOptFirstArg((char*)args,&nameStr,&teleStr); if(!teleStr) return false; - + Player* target; uint64 target_guid; std::string target_name; diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index e7eeda7966d..31834fce8ea 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -88,7 +88,7 @@ bool ChatHandler::HandleMuteCommand(const char* args) if (target) target->GetSession()->m_muteTime = mutetime; - LoginDatabase.PExecute("UPDATE account SET mutetime = " I64FMTD " WHERE id = '%u'",uint64(mutetime), account_id ); + LoginDatabase.PExecute("UPDATE account SET mutetime = " UI64FMTD " WHERE id = '%u'",uint64(mutetime), account_id ); if(target) ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime); @@ -3890,6 +3890,40 @@ bool ChatHandler::HandleCombatStopCommand(const char* args) return true; } +void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) +{ + uint32 classmask = player->getClassMask(); + + for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + { + SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); + if (!skillLine) + continue; + + // wrong skill + if( skillLine->skillId != skill_id) + continue; + + // not high rank + if(skillLine->forward_spellid ) + continue; + + // skip racial skills + if (skillLine->racemask != 0) + continue; + + // skip wrong class skills + if( skillLine->classmask && (skillLine->classmask & classmask) == 0) + continue; + + SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); + if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,player,false)) + continue; + + player->learnSpell(skillLine->spellId,false); + } +} + bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) { uint32 classmask = m_session->GetPlayer()->getClassMask(); @@ -3900,31 +3934,10 @@ bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) if( !skillInfo ) continue; - if( skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY ) + if ((skillInfo->categoryId == SKILL_CATEGORY_PROFESSION || skillInfo->categoryId == SKILL_CATEGORY_SECONDARY) && + skillInfo->canLink) // only prof. with recipes have { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) - { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if( !skillLine ) - continue; - - // skip racial skills - if( skillLine->racemask != 0 ) - continue; - - // skip wrong class skills - if( skillLine->classmask && (skillLine->classmask & classmask) == 0) - continue; - - if( skillLine->skillId != i || skillLine->forward_spellid ) - continue; - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) - continue; - - m_session->GetPlayer()->learnSpell(skillLine->spellId,false); - } + HandleLearnSkillRecipesHelper(m_session->GetPlayer(),skillInfo->id); } } @@ -3959,54 +3972,58 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) uint32 classmask = m_session->GetPlayer()->getClassMask(); - for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) + std::string name; + + SkillLineEntry const *targetSkillInfo = NULL; + for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); - if( !skillInfo ) + if (!skillInfo) continue; - if( skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && - skillInfo->categoryId != SKILL_CATEGORY_SECONDARY ) + if ((skillInfo->categoryId != SKILL_CATEGORY_PROFESSION && + skillInfo->categoryId != SKILL_CATEGORY_SECONDARY) || + !skillInfo->canLink) // only prof with recipes have set continue; int loc = GetSessionDbcLocale(); - std::string name = skillInfo->name[loc]; + name = skillInfo->name[loc]; + if(name.empty()) + continue; - if(Utf8FitTo(name, wnamepart)) + if (!Utf8FitTo(name, wnamepart)) { - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + loc = 0; + for(; loc < MAX_LOCALE; ++loc) { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if( !skillLine ) - continue; - - if( skillLine->skillId != i || skillLine->forward_spellid ) + if(loc==GetSessionDbcLocale()) continue; - // skip racial skills - if( skillLine->racemask != 0 ) + name = skillInfo->name[loc]; + if(name.empty()) continue; - // skip wrong class skills - if( skillLine->classmask && (skillLine->classmask & classmask) == 0) - continue; - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId); - if(!spellInfo || !SpellMgr::IsSpellValid(spellInfo,m_session->GetPlayer(),false)) - continue; - - if( !target->HasSpell(spellInfo->Id) ) - m_session->GetPlayer()->learnSpell(skillLine->spellId,false); + if (Utf8FitTo(name, wnamepart)) + break; } + } - uint16 maxLevel = target->GetPureMaxSkillValue(skillInfo->id); - target->SetSkill(skillInfo->id, maxLevel, maxLevel); - PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); - return true; + if(loc < MAX_LOCALE) + { + targetSkillInfo = skillInfo; + break; } } - return false; + if(!targetSkillInfo) + return false; + + HandleLearnSkillRecipesHelper(target,targetSkillInfo->id); + + uint16 maxLevel = target->GetPureMaxSkillValue(targetSkillInfo->id); + target->SetSkill(targetSkillInfo->id, maxLevel, maxLevel); + PSendSysMessage(LANG_COMMAND_LEARN_ALL_RECIPES, name.c_str()); + return true; } bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 0b883b137de..d384efc1b07 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -3779,7 +3779,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args) bool ChatHandler::HandleGuildCreateCommand(const char* args) { if(!*args) - return false; + return false; // if not guild name only (in "") then player name Player* target; @@ -3818,7 +3818,7 @@ bool ChatHandler::HandleGuildCreateCommand(const char* args) bool ChatHandler::HandleGuildInviteCommand(const char *args) { if(!*args) - return false; + return false; // if not guild name only (in "") then player name uint64 target_guid; diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 337604f2a2a..0af4999092f 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -289,7 +289,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data ) } //called when mail is read -void WorldSession::HandleMarkAsRead(WorldPacket & recv_data ) +void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+4); @@ -335,7 +335,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data ) pl->SendMailResult(mailId, MAIL_DELETED, MAIL_OK); } -void WorldSession::HandleReturnToSender(WorldPacket & recv_data ) +void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+4); @@ -442,7 +442,7 @@ void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint } //called when player takes item attached in mail -void WorldSession::HandleTakeItem(WorldPacket & recv_data ) +void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+4+4); @@ -537,7 +537,7 @@ void WorldSession::HandleTakeItem(WorldPacket & recv_data ) pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg); } -void WorldSession::HandleTakeMoney(WorldPacket & recv_data ) +void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+4); @@ -573,7 +573,7 @@ void WorldSession::HandleTakeMoney(WorldPacket & recv_data ) } //called when player lists his received mails -void WorldSession::HandleGetMail(WorldPacket & recv_data ) +void WorldSession::HandleGetMailList(WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8); @@ -761,7 +761,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data ) } //TODO Fix me! ... this void has probably bad condition, but good data are sent -void WorldSession::HandleMsgQueryNextMailtime(WorldPacket & /*recv_data*/ ) +void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/ ) { WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8); @@ -891,7 +891,7 @@ void WorldSession::SendMailTo(Player* receiver, uint8 messageType, uint8 station CharacterDatabase.BeginTransaction(); CharacterDatabase.escape_string(subject); CharacterDatabase.PExecute("INSERT INTO mail (id,messageType,stationery,mailTemplateId,sender,receiver,subject,itemTextId,has_items,expire_time,deliver_time,money,cod,checked) " - "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%u', '%u', '" I64FMTD "','" I64FMTD "', '%u', '%u', '%d')", + "VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%u', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%d')", mailId, messageType, stationery, mailTemplateId, sender_guidlow_or_entry, receiver_guidlow, subject.c_str(), itemTextId, (mi && !mi->empty() ? 1 : 0), (uint64)expire_time, (uint64)deliver_time, money, COD, checked); if(mi) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 8efba9785c2..144dce1edf6 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -501,7 +501,7 @@ Map::Add(T *obj) if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("Map::Add: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + sLog.outError("Map::Add: Object " UI64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -2020,12 +2020,9 @@ void Map::SendInitSelf( Player * player ) UpdateData data; - bool hasTransport = false; - // attach to player data current transport data if(Transport* transport = player->GetTransport()) { - hasTransport = true; transport->BuildCreateUpdateBlockForPlayer(&data, player); } @@ -2039,14 +2036,13 @@ void Map::SendInitSelf( Player * player ) { if(player!=(*itr) && player->HaveAtClient(*itr)) { - hasTransport = true; (*itr)->BuildCreateUpdateBlockForPlayer(&data, player); } } } WorldPacket packet; - data.BuildPacket(&packet, hasTransport); + data.BuildPacket(&packet); player->GetSession()->SendPacket(&packet); } @@ -2063,20 +2059,17 @@ void Map::SendInitTransports( Player * player ) MapManager::TransportSet& tset = tmap[player->GetMapId()]; - bool hasTransport = false; - for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i) { // send data for current transport in other place if((*i) != player->GetTransport() && (*i)->GetMapId()==i_id) { - hasTransport = true; (*i)->BuildCreateUpdateBlockForPlayer(&transData, player); } } WorldPacket packet; - transData.BuildPacket(&packet, hasTransport); + transData.BuildPacket(&packet); player->GetSession()->SendPacket(&packet); } diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 9ccae7798bd..c493d10de56 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -526,7 +526,7 @@ void WorldSession::HandleStandStateChangeOpcode( WorldPacket & recv_data ) _player->SetStandState(animstate); } -void WorldSession::HandleFriendListOpcode( WorldPacket & recv_data ) +void WorldSession::HandleContactListOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 4); sLog.outDebug( "WORLD: Received CMSG_CONTACT_LIST" ); @@ -715,9 +715,10 @@ void WorldSession::HandleDelIgnoreOpcode( WorldPacket & recv_data ) sLog.outDebug( "WORLD: Sent motd (SMSG_FRIEND_STATUS)" ); } -void WorldSession::HandleSetFriendNoteOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetContactNotesOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 8+1); + sLog.outDebug("CMSG_SET_CONTACT_NOTES"); uint64 guid; std::string note; recv_data >> guid >> note; @@ -753,7 +754,7 @@ void WorldSession::HandleBugOpcode( WorldPacket & recv_data ) CharacterDatabase.PExecute ("INSERT INTO bugreport (type,content) VALUES('%s', '%s')", type.c_str( ), content.c_str( )); } -void WorldSession::HandleCorpseReclaimOpcode(WorldPacket &recv_data) +void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) { CHECK_PACKET_SIZE(recv_data,8); @@ -1071,7 +1072,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) } } -void WorldSession::HandleCompleteCinema( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleCompleteCinematic( WorldPacket & /*recv_data*/ ) { DEBUG_LOG( "WORLD: Player is watching cinema" ); } @@ -1131,8 +1132,8 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket&/* recv_data*/) recv_data >> Orientation; // TODO for later may be we can use for anticheat - DEBUG_LOG("Guid " I64FMTD,guid); - DEBUG_LOG("unknown1 " I64FMTD,unknown1); + DEBUG_LOG("Guid " UI64FMTD,guid); + DEBUG_LOG("unknown1 " UI64FMTD,unknown1); DEBUG_LOG("unknown2 %u",unknown2); DEBUG_LOG("X %f",PositionX); DEBUG_LOG("Y %f",PositionY); @@ -1165,8 +1166,8 @@ void WorldSession::HandleMoveRootAck(WorldPacket&/* recv_data*/) recv_data >> Orientation; // for later may be we can use for anticheat - DEBUG_LOG("Guid " I64FMTD,guid); - DEBUG_LOG("unknown1 " I64FMTD,unknown1); + DEBUG_LOG("Guid " UI64FMTD,guid); + DEBUG_LOG("unknown1 " UI64FMTD,unknown1); DEBUG_LOG("unknown1 %u",unknown2); DEBUG_LOG("X %f",PositionX); DEBUG_LOG("Y %f",PositionY); @@ -1175,7 +1176,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket&/* recv_data*/) */ } -void WorldSession::HandleSetActionBar(WorldPacket& recv_data) +void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) { CHECK_PACKET_SIZE(recv_data,1); @@ -1186,7 +1187,7 @@ void WorldSession::HandleSetActionBar(WorldPacket& recv_data) if(!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED) { if(ActionBar!=0) - sLog.outError("WorldSession::HandleSetActionBar in not logged state with value: %u, ignored",uint32(ActionBar)); + sLog.outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored",uint32(ActionBar)); return; } @@ -1221,7 +1222,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) uint64 guid; recv_data >> guid; - DEBUG_LOG("Inspected guid is " I64FMTD, guid); + DEBUG_LOG("Inspected guid is " UI64FMTD, guid); _player->SetSelection(guid); @@ -1426,10 +1427,10 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) sLog.outDebug("Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str()); } -void WorldSession::HandleReportSpamOpcode( WorldPacket & recv_data ) +void WorldSession::HandleComplainOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 1+8); - sLog.outDebug("WORLD: CMSG_REPORT_SPAM"); + sLog.outDebug("WORLD: CMSG_COMPLAIN"); recv_data.hexlike(); uint8 spam_type; // 0 - mail, 1 - chat @@ -1470,7 +1471,7 @@ void WorldSession::HandleReportSpamOpcode( WorldPacket & recv_data ) sLog.outDebug("REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str()); } -void WorldSession::HandleRealmStateRequestOpcode( WorldPacket & recv_data ) +void WorldSession::HandleRealmSplitOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 4); @@ -1525,7 +1526,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data ) GetPlayer()->SetToNotify(); } -void WorldSession::HandleChooseTitleOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetTitleOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 4); @@ -1574,7 +1575,7 @@ void WorldSession::HandleResetInstancesOpcode( WorldPacket & /*recv_data*/ ) _player->ResetInstances(INSTANCE_RESET_ALL); } -void WorldSession::HandleDungeonDifficultyOpcode( WorldPacket & recv_data ) +void WorldSession::HandleSetDungeonDifficultyOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 4); @@ -1588,7 +1589,7 @@ void WorldSession::HandleDungeonDifficultyOpcode( WorldPacket & recv_data ) if(mode > DIFFICULTY_HEROIC) { - sLog.outError("WorldSession::HandleDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); + sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d sent an invalid instance mode %d!", _player->GetGUIDLow(), mode); return; } @@ -1596,7 +1597,7 @@ void WorldSession::HandleDungeonDifficultyOpcode( WorldPacket & recv_data ) Map *map = _player->GetMap(); if(map && map->IsDungeon()) { - sLog.outError("WorldSession::HandleDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); + sLog.outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); return; } @@ -1620,7 +1621,7 @@ void WorldSession::HandleDungeonDifficultyOpcode( WorldPacket & recv_data ) } } -void WorldSession::HandleDismountOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleCancelMountAuraOpcode( WorldPacket & /*recv_data*/ ) { sLog.outDebug("WORLD: CMSG_CANCEL_MOUNT_AURA"); //recv_data.hexlike(); @@ -1642,7 +1643,7 @@ void WorldSession::HandleDismountOpcode( WorldPacket & /*recv_data*/ ) _player->RemoveAurasByType(SPELL_AURA_MOUNTED); } -void WorldSession::HandleMoveFlyModeChangeAckOpcode( WorldPacket & recv_data ) +void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 8+4+4); @@ -1657,16 +1658,6 @@ void WorldSession::HandleMoveFlyModeChangeAckOpcode( WorldPacket & recv_data ) recv_data >> guid >> unk >> flags; _player->SetUnitMovementFlags(flags); - /* - on: - 25 00 00 00 00 00 00 00 | 00 00 00 00 00 00 80 00 - 85 4E A9 01 19 BA 7A C3 | 42 0D 70 44 44 B0 A8 42 - 78 15 94 40 39 03 00 00 | 00 00 80 3F - off: - 25 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 - 10 FD A9 01 19 BA 7A C3 | 42 0D 70 44 44 B0 A8 42 - 78 15 94 40 39 03 00 00 | 00 00 00 00 - */ } void WorldSession::HandleRequestPetInfoOpcode( WorldPacket & /*recv_data */) @@ -1687,7 +1678,7 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode( WorldPacket & recv_data ) sLog.outDebug("Client used \"/timetest %d\" command", mode); } -void WorldSession::HandleInspectAchievements( WorldPacket & recv_data ) +void WorldSession::HandleQueryInspectAchievements( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data, 1); uint64 guid; diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 53aa5923782..2fa6adf5a13 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -173,7 +173,7 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) recv_data >> guid; recv_data >> flags >> time; - DEBUG_LOG("Guid " I64FMTD,guid); + DEBUG_LOG("Guid " UI64FMTD,guid); DEBUG_LOG("Flags %u, time %u",flags, time/IN_MILISECONDS); Unit *mover = _player->m_mover; diff --git a/src/game/Object.cpp b/src/game/Object.cpp index a1f54398331..8dd558ca42c 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -62,7 +62,7 @@ uint32 GuidHigh2TypeId(uint32 guid_hi) case HIGHGUID_MO_TRANSPORT: return TYPEID_GAMEOBJECT; case HIGHGUID_VEHICLE: return TYPEID_UNIT; } - return MAX_TYPEID; // unknown + return NUM_CLIENT_OBJECT_TYPES; // unknown } Object::Object( ) @@ -88,7 +88,7 @@ Object::~Object( ) if(IsInWorld()) { - sLog.outCrash("Object::~Object - guid="I64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId()); + sLog.outCrash("Object::~Object - guid="UI64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId()); assert(false); } @@ -120,7 +120,7 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh ) { if(!m_uint32Values) _InitValues(); - uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh); // required more changes to make it working + uint64 guid = MAKE_NEW_GUID(guidlow, entry, guidhigh); SetUInt64Value( OBJECT_FIELD_GUID, guid ); SetUInt32Value( OBJECT_FIELD_TYPE, m_objectType ); m_PackGUID.clear(); @@ -129,10 +129,10 @@ void Object::_Create( uint32 guidlow, uint32 entry, HighGuid guidhigh ) void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags ) const { - ByteBuffer buf(500); + ByteBuffer buf(50); buf << uint8( UPDATETYPE_MOVEMENT ); - buf << GetGUID(); + buf.append(GetPackGUID()); _BuildMovementUpdate(&buf, flags); @@ -142,15 +142,13 @@ void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags ) const void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const { if(!target) - { return; - } uint8 updatetype = UPDATETYPE_CREATE_OBJECT; uint8 flags = m_updateFlag; /** lower flag1 **/ - if(target == this) // building packet for oneself + if(target == this) // building packet for yourself flags |= UPDATEFLAG_SELF; if(flags & UPDATEFLAG_HAS_POSITION) @@ -191,10 +189,9 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c //sLog.outDebug("BuildCreateUpdate: update-type: %u, object-type: %u got flags: %X, flags2: %X", updatetype, m_objectTypeId, flags, flags2); - ByteBuffer buf(500); + ByteBuffer buf(50); buf << (uint8)updatetype; - //buf.append(GetPackGUID()); //client crashes when using this - buf << (uint8)0xFF << GetGUID(); + buf.append(GetPackGUID()); buf << (uint8)m_objectTypeId; _BuildMovementUpdate(&buf, flags); @@ -202,7 +199,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetCreateBits( &updateMask, target ); - _BuildValuesUpdate(updatetype, &buf, &updateMask, target ); + _BuildValuesUpdate(updatetype, &buf, &updateMask, target); data->AddUpdateBlock(buf); } @@ -224,24 +221,20 @@ void Object::SendUpdateToPlayer(Player* player) BuildCreateUpdateBlockForPlayer(&upd, player); upd.BuildPacket(&packet); player->GetSession()->SendPacket(&packet); - - // now object updated/(create updated) } void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const { - ByteBuffer buf(500); + ByteBuffer buf(50); buf << (uint8) UPDATETYPE_VALUES; - //buf.append(GetPackGUID()); //client crashes when using this. but not have crash in debug mode - buf << (uint8)0xFF; - buf << GetGUID(); + buf.append(GetPackGUID()); UpdateMask updateMask; updateMask.SetCount( m_valuesCount ); _SetUpdateBits( &updateMask, target ); - _BuildValuesUpdate(UPDATETYPE_VALUES, &buf, &updateMask, target ); + _BuildValuesUpdate(UPDATETYPE_VALUES, &buf, &updateMask, target); data->AddUpdateBlock(buf); } @@ -256,7 +249,7 @@ void Object::DestroyForPlayer(Player *target) const ASSERT(target); WorldPacket data(SMSG_DESTROY_OBJECT, 8); - data << GetGUID(); + data << uint64(GetGUID()); data << uint8(0); // WotLK (bool) target->GetSession()->SendPacket( &data ); } @@ -502,7 +495,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask updateMask->SetBit(GAMEOBJECT_BYTES_1); } } - else //case UPDATETYPE_VALUES + else // case UPDATETYPE_VALUES { if (isType(TYPEMASK_GAMEOBJECT) && !((GameObject*)this)->IsTransport()) { @@ -659,7 +652,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *data << uint32(1); break; default: - *data << uint32(0); // unknown. not happen. + *data << uint32(0); // unknown, not happen. break; } } @@ -946,21 +939,21 @@ void Object::ApplyModUInt32Value(uint16 index, int32 val, bool apply) cur += (apply ? val : -val); if(cur < 0) cur = 0; - SetUInt32Value(index,cur); + SetUInt32Value(index, cur); } void Object::ApplyModInt32Value(uint16 index, int32 val, bool apply) { int32 cur = GetInt32Value(index); cur += (apply ? val : -val); - SetInt32Value(index,cur); + SetInt32Value(index, cur); } void Object::ApplyModSignedFloatValue(uint16 index, float val, bool apply) { float cur = GetFloatValue(index); cur += (apply ? val : -val); - SetFloatValue(index,cur); + SetFloatValue(index, cur); } void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) @@ -969,7 +962,7 @@ void Object::ApplyModPositiveFloatValue(uint16 index, float val, bool apply) cur += (apply ? val : -val); if(cur < 0) cur = 0; - SetFloatValue(index,cur); + SetFloatValue(index, cur); } void Object::SetFlag( uint16 index, uint32 newFlag ) @@ -1133,17 +1126,17 @@ void WorldObject::_Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid, uint uint32 WorldObject::GetZoneId() const { - return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX,m_positionY,m_positionZ); + return MapManager::Instance().GetBaseMap(m_mapId)->GetZoneId(m_positionX, m_positionY, m_positionZ); } uint32 WorldObject::GetAreaId() const { - return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX,m_positionY,m_positionZ); + return MapManager::Instance().GetBaseMap(m_mapId)->GetAreaId(m_positionX, m_positionY, m_positionZ); } void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const { - MapManager::Instance().GetBaseMap(m_mapId)->GetZoneAndAreaId(zoneid,areaid,m_positionX,m_positionY,m_positionZ); + MapManager::Instance().GetBaseMap(m_mapId)->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ); } InstanceData* WorldObject::GetInstanceData() @@ -1653,10 +1646,10 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* *data << (uint8)msgtype; *data << (uint32)language; *data << (uint64)GetGUID(); - *data << (uint32)0; //2.1.0 + *data << (uint32)0; // 2.1.0 *data << (uint32)(strlen(name)+1); *data << name; - *data << (uint64)targetGuid; //Unit Target + *data << (uint64)targetGuid; // Unit Target if( targetGuid && !IS_PLAYER_GUID(targetGuid) ) { *data << (uint32)1; // target name length @@ -1679,7 +1672,7 @@ void WorldObject::BuildHeartBeatMsg(WorldPacket *data) const data->append(GetPackGUID()); *data << uint32(((Unit*)this)->GetUnitMovementFlags()); // movement flags *data << uint16(0); // 2.3.0 - *data << getMSTime(); // time + *data << uint32(getMSTime()); // time *data << m_positionX; *data << m_positionY; *data << m_positionZ; @@ -1699,7 +1692,7 @@ void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float *data << uint32(0); // this value increments every time *data << uint32(((Unit*)this)->GetUnitMovementFlags()); // movement flags *data << uint16(0); // 2.3.0 - *data << getMSTime(); // time + *data << uint32(getMSTime()); // time *data << x; *data << y; *data << z; @@ -2277,7 +2270,7 @@ void WorldObject::PlayDistanceSound( uint32 sound_id, Player* target /*= NULL*/ { WorldPacket data(SMSG_PLAY_OBJECT_SOUND,4+8); data << uint32(sound_id); - data << GetGUID(); + data << uint64(GetGUID()); if (target) target->SendDirectMessage( &data ); else diff --git a/src/game/Object.h b/src/game/Object.h index fa2a3a7eeb3..4970b4bab01 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -55,8 +55,6 @@ enum TypeMask TYPEMASK_GAMEOBJECT = 0x0020, TYPEMASK_DYNAMICOBJECT = 0x0040, TYPEMASK_CORPSE = 0x0080, - TYPEMASK_AIGROUP = 0x0100, - TYPEMASK_AREATRIGGER = 0x0200, TYPEMASK_SEER = TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT }; @@ -69,11 +67,10 @@ enum TypeID TYPEID_PLAYER = 4, TYPEID_GAMEOBJECT = 5, TYPEID_DYNAMICOBJECT = 6, - TYPEID_CORPSE = 7, - TYPEID_AIGROUP = 8, - TYPEID_AREATRIGGER = 9 + TYPEID_CORPSE = 7 }; -#define MAX_TYPEID 10 + +#define NUM_CLIENT_OBJECT_TYPES 8 uint32 GuidHigh2TypeId(uint32 guid_hi); diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 1e4074684f1..9736f9751eb 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -130,7 +130,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, CellPair q = Trinity::ComputeCellPair(obj->GetPositionX(),obj->GetPositionY()); if(q.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || q.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("ObjectAccessor::GetObjecInWorld: object "I64FMTD" has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); + sLog.outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); return NULL; } diff --git a/src/game/ObjectDefines.h b/src/game/ObjectDefines.h index ee58e8a5f34..028367a7bf8 100644 --- a/src/game/ObjectDefines.h +++ b/src/game/ObjectDefines.h @@ -25,8 +25,8 @@ // used for creating values for respawn for example #define MAKE_PAIR64(l, h) uint64( uint32(l) | ( uint64(h) << 32 ) ) -#define PAIR64_HIPART(x) (uint32)((uint64(x) >> 32) & 0x00000000FFFFFFFFLL) -#define PAIR64_LOPART(x) (uint32)(uint64(x) & 0x00000000FFFFFFFFLL) +#define PAIR64_HIPART(x) (uint32)((uint64(x) >> 32) & UI64LIT(0x00000000FFFFFFFF)) +#define PAIR64_LOPART(x) (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF)) #define MAKE_PAIR32(l, h) uint32( uint16(l) | ( uint32(h) << 16 ) ) #define PAIR32_HIPART(x) (uint16)((uint32(x) >> 16) & 0x0000FFFF) @@ -72,9 +72,9 @@ enum HighGuid // We have different low and middle part size for different guid types #define _GUID_ENPART_2(x) 0 -#define _GUID_ENPART_3(x) (uint32)((uint64(x) >> 24) & 0x0000000000FFFFFFLL) -#define _GUID_LOPART_2(x) (uint32)(uint64(x) & 0x00000000FFFFFFFFLL) -#define _GUID_LOPART_3(x) (uint32)(uint64(x) & 0x0000000000FFFFFFLL) +#define _GUID_ENPART_3(x) (uint32)((uint64(x) >> 24) & UI64LIT(0x0000000000FFFFFF)) +#define _GUID_LOPART_2(x) (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF)) +#define _GUID_LOPART_3(x) (uint32)(uint64(x) & UI64LIT(0x0000000000FFFFFF)) inline bool IsGuidHaveEnPart(uint64 const& guid) { diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 1b661bc41ba..27e1a175de2 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -802,6 +802,15 @@ void ObjectMgr::LoadCreatureAddons() if(!addon) continue; + if (addon->mount) + { + if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount)) + sLog.outErrorDb("Creature (Entry %u) have invalid displayInfoId for mount (%u) defined in `creature_template_addon`.",addon->guidOrEntry, addon->mount); + } + + if (!sEmotesStore.LookupEntry(addon->emote)) + sLog.outErrorDb("Creature (Entry %u) have invalid emote (%u) defined in `creature_template_addon`.",addon->guidOrEntry, addon->emote); + ConvertCreatureAddonAuras(const_cast<CreatureDataAddon*>(addon), "creature_template_addon", "Entry"); if(!sCreatureStorage.LookupEntry<CreatureInfo>(addon->guidOrEntry)) @@ -820,6 +829,15 @@ void ObjectMgr::LoadCreatureAddons() if(!addon) continue; + if (addon->mount) + { + if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount)) + sLog.outErrorDb("Creature (GUID %u) have invalid displayInfoId for mount (%u) defined in `creature_addon`.",addon->guidOrEntry, addon->mount); + } + + if (!sEmotesStore.LookupEntry(addon->emote)) + sLog.outErrorDb("Creature (GUID %u) have invalid emote (%u) defined in `creature_addon`.",addon->guidOrEntry, addon->emote); + ConvertCreatureAddonAuras(const_cast<CreatureDataAddon*>(addon), "creature_addon", "GUIDLow"); if(mCreatureDataMap.find(addon->guidOrEntry)==mCreatureDataMap.end()) @@ -4610,9 +4628,9 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) sLog.outDebug("Returning mails current time: hour: %d, minute: %d, second: %d ", localtime(&basetime)->tm_hour, localtime(&basetime)->tm_min, localtime(&basetime)->tm_sec); //delete all old mails without item and without body immediately, if starting server if (!serverUp) - CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" I64FMTD "' AND has_items = '0' AND itemTextId = 0", (uint64)basetime); + CharacterDatabase.PExecute("DELETE FROM mail WHERE expire_time < '" UI64FMTD "' AND has_items = '0' AND itemTextId = 0", (uint64)basetime); // 0 1 2 3 4 5 6 7 8 9 - QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" I64FMTD "'", (uint64)basetime); + QueryResult* result = CharacterDatabase.PQuery("SELECT id,messageType,sender,receiver,itemTextId,has_items,expire_time,cod,checked,mailTemplateId FROM mail WHERE expire_time < '" UI64FMTD "'", (uint64)basetime); if ( !result ) { barGoLink bar(1); @@ -4687,7 +4705,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) else { //mail will be returned: - CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" I64FMTD "', deliver_time = '" I64FMTD "',cod = '0', checked = '%u' WHERE id = '%u'", m->receiver, m->sender, (uint64)(basetime + 30*DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID); + CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',cod = '0', checked = '%u' WHERE id = '%u'", m->receiver, m->sender, (uint64)(basetime + 30*DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID); delete m; continue; } @@ -6443,7 +6461,7 @@ void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t mCreatureRespawnTimes[MAKE_PAIR64(loguid,instance)] = t; WorldDatabase.PExecute("DELETE FROM creature_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance); if(t) - WorldDatabase.PExecute("INSERT INTO creature_respawn VALUES ( '%u', '" I64FMTD "', '%u' )", loguid, uint64(t), instance); + WorldDatabase.PExecute("INSERT INTO creature_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance); } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -6461,7 +6479,7 @@ void ObjectMgr::SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t) mGORespawnTimes[MAKE_PAIR64(loguid,instance)] = t; WorldDatabase.PExecute("DELETE FROM gameobject_respawn WHERE guid = '%u' AND instance = '%u'", loguid, instance); if(t) - WorldDatabase.PExecute("INSERT INTO gameobject_respawn VALUES ( '%u', '" I64FMTD "', '%u' )", loguid, uint64(t), instance); + WorldDatabase.PExecute("INSERT INTO gameobject_respawn VALUES ( '%u', '" UI64FMTD "', '%u' )", loguid, uint64(t), instance); } void ObjectMgr::DeleteRespawnTimeForInstance(uint32 instance) diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 536423345c6..8382b8ddbb4 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -118,7 +118,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x057*/ { "CMSG_ITEM_QUERY_MULTIPLE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x058*/ { "SMSG_ITEM_QUERY_SINGLE_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x059*/ { "SMSG_ITEM_QUERY_MULTIPLE_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x05A*/ { "CMSG_PAGE_TEXT_QUERY", STATUS_LOGGEDIN, &WorldSession::HandlePageQueryOpcode }, + /*0x05A*/ { "CMSG_PAGE_TEXT_QUERY", STATUS_LOGGEDIN, &WorldSession::HandlePageTextQueryOpcode }, /*0x05B*/ { "SMSG_PAGE_TEXT_QUERY_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x05C*/ { "CMSG_QUEST_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleQuestQueryOpcode }, /*0x05D*/ { "SMSG_QUEST_QUERY_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -130,28 +130,28 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x063*/ { "SMSG_WHO", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x064*/ { "CMSG_WHOIS", STATUS_LOGGEDIN, &WorldSession::HandleWhoisOpcode }, /*0x065*/ { "SMSG_WHOIS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x066*/ { "CMSG_CONTACT_LIST", STATUS_LOGGEDIN, &WorldSession::HandleFriendListOpcode }, + /*0x066*/ { "CMSG_CONTACT_LIST", STATUS_LOGGEDIN, &WorldSession::HandleContactListOpcode }, /*0x067*/ { "SMSG_CONTACT_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x068*/ { "SMSG_FRIEND_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x069*/ { "CMSG_ADD_FRIEND", STATUS_LOGGEDIN, &WorldSession::HandleAddFriendOpcode }, /*0x06A*/ { "CMSG_DEL_FRIEND", STATUS_LOGGEDIN, &WorldSession::HandleDelFriendOpcode }, - /*0x06B*/ { "CMSG_SET_CONTACT_NOTES", STATUS_LOGGEDIN, &WorldSession::HandleSetFriendNoteOpcode }, + /*0x06B*/ { "CMSG_SET_CONTACT_NOTES", STATUS_LOGGEDIN, &WorldSession::HandleSetContactNotesOpcode }, /*0x06C*/ { "CMSG_ADD_IGNORE", STATUS_LOGGEDIN, &WorldSession::HandleAddIgnoreOpcode }, /*0x06D*/ { "CMSG_DEL_IGNORE", STATUS_LOGGEDIN, &WorldSession::HandleDelIgnoreOpcode }, /*0x06E*/ { "CMSG_GROUP_INVITE", STATUS_LOGGEDIN, &WorldSession::HandleGroupInviteOpcode }, /*0x06F*/ { "SMSG_GROUP_INVITE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x070*/ { "CMSG_GROUP_CANCEL", STATUS_LOGGEDIN, &WorldSession::Handle_Deprecated }, + /*0x070*/ { "CMSG_GROUP_CANCEL", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, /*0x071*/ { "SMSG_GROUP_CANCEL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x072*/ { "CMSG_GROUP_ACCEPT", STATUS_LOGGEDIN, &WorldSession::HandleGroupAcceptOpcode }, /*0x073*/ { "CMSG_GROUP_DECLINE", STATUS_LOGGEDIN, &WorldSession::HandleGroupDeclineOpcode }, /*0x074*/ { "SMSG_GROUP_DECLINE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x075*/ { "CMSG_GROUP_UNINVITE", STATUS_LOGGEDIN, &WorldSession::HandleGroupUninviteNameOpcode }, + /*0x075*/ { "CMSG_GROUP_UNINVITE", STATUS_LOGGEDIN, &WorldSession::HandleGroupUninviteOpcode }, /*0x076*/ { "CMSG_GROUP_UNINVITE_GUID", STATUS_LOGGEDIN, &WorldSession::HandleGroupUninviteGuidOpcode }, /*0x077*/ { "SMSG_GROUP_UNINVITE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x078*/ { "CMSG_GROUP_SET_LEADER", STATUS_LOGGEDIN, &WorldSession::HandleGroupSetLeaderOpcode }, /*0x079*/ { "SMSG_GROUP_SET_LEADER", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x07A*/ { "CMSG_LOOT_METHOD", STATUS_LOGGEDIN, &WorldSession::HandleLootMethodOpcode }, - /*0x07B*/ { "CMSG_GROUP_DISBAND", STATUS_LOGGEDIN, &WorldSession::HandleGroupLeaveOpcode }, + /*0x07B*/ { "CMSG_GROUP_DISBAND", STATUS_LOGGEDIN, &WorldSession::HandleGroupDisbandOpcode }, /*0x07C*/ { "SMSG_GROUP_DESTROYED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x07D*/ { "SMSG_GROUP_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x07E*/ { "SMSG_PARTY_MEMBER_STATS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -179,8 +179,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x094*/ { "UMSG_UPDATE_GUILD", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x095*/ { "CMSG_MESSAGECHAT", STATUS_LOGGEDIN, &WorldSession::HandleMessagechatOpcode }, /*0x096*/ { "SMSG_MESSAGECHAT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x097*/ { "CMSG_JOIN_CHANNEL", STATUS_LOGGEDIN, &WorldSession::HandleChannelJoin }, - /*0x098*/ { "CMSG_LEAVE_CHANNEL", STATUS_LOGGEDIN, &WorldSession::HandleChannelLeave }, + /*0x097*/ { "CMSG_JOIN_CHANNEL", STATUS_LOGGEDIN, &WorldSession::HandleJoinChannel }, + /*0x098*/ { "CMSG_LEAVE_CHANNEL", STATUS_LOGGEDIN, &WorldSession::HandleLeaveChannel }, /*0x099*/ { "SMSG_CHANNEL_NOTIFY", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x09A*/ { "CMSG_CHANNEL_LIST", STATUS_LOGGEDIN, &WorldSession::HandleChannelList }, /*0x09B*/ { "SMSG_CHANNEL_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -195,7 +195,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x0A4*/ { "CMSG_CHANNEL_KICK", STATUS_LOGGEDIN, &WorldSession::HandleChannelKick }, /*0x0A5*/ { "CMSG_CHANNEL_BAN", STATUS_LOGGEDIN, &WorldSession::HandleChannelBan }, /*0x0A6*/ { "CMSG_CHANNEL_UNBAN", STATUS_LOGGEDIN, &WorldSession::HandleChannelUnban }, - /*0x0A7*/ { "CMSG_CHANNEL_ANNOUNCEMENTS", STATUS_LOGGEDIN, &WorldSession::HandleChannelAnnounce }, + /*0x0A7*/ { "CMSG_CHANNEL_ANNOUNCEMENTS", STATUS_LOGGEDIN, &WorldSession::HandleChannelAnnouncements }, /*0x0A8*/ { "CMSG_CHANNEL_MODERATE", STATUS_LOGGEDIN, &WorldSession::HandleChannelModerate }, /*0x0A9*/ { "SMSG_UPDATE_OBJECT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x0AA*/ { "SMSG_DESTROY_OBJECT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -248,7 +248,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x0D9*/ { "MSG_MOVE_TOGGLE_COLLISION_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x0DA*/ { "MSG_MOVE_SET_FACING", STATUS_LOGGEDIN, &WorldSession::HandleMovementOpcodes }, /*0x0DB*/ { "MSG_MOVE_SET_PITCH", STATUS_LOGGEDIN, &WorldSession::HandleMovementOpcodes }, - /*0x0DC*/ { "MSG_MOVE_WORLDPORT_ACK", STATUS_TRANSFER_PENDING,&WorldSession::HandleMoveWorldportAckOpcode}, + /*0x0DC*/ { "MSG_MOVE_WORLDPORT_ACK", STATUS_TRANSFER, &WorldSession::HandleMoveWorldportAckOpcode }, /*0x0DD*/ { "SMSG_MONSTER_MOVE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x0DE*/ { "SMSG_MOVE_WATER_WALK", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x0DF*/ { "SMSG_MOVE_LAND_WALK", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -280,7 +280,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x0F9*/ { "CMSG_OPENING_CINEMATIC", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x0FA*/ { "SMSG_TRIGGER_CINEMATIC", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x0FB*/ { "CMSG_NEXT_CINEMATIC_CAMERA", STATUS_LOGGEDIN, &WorldSession::HandleNextCinematicCamera }, - /*0x0FC*/ { "CMSG_COMPLETE_CINEMATIC", STATUS_LOGGEDIN, &WorldSession::HandleCompleteCinema }, + /*0x0FC*/ { "CMSG_COMPLETE_CINEMATIC", STATUS_LOGGEDIN, &WorldSession::HandleCompleteCinematic }, /*0x0FD*/ { "SMSG_TUTORIAL_FLAGS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x0FE*/ { "CMSG_TUTORIAL_FLAG", STATUS_LOGGEDIN, &WorldSession::HandleTutorialFlag }, /*0x0FF*/ { "CMSG_TUTORIAL_CLEAR", STATUS_LOGGEDIN, &WorldSession::HandleTutorialClear }, @@ -418,11 +418,11 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x183*/ { "SMSG_QUESTGIVER_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x184*/ { "CMSG_QUESTGIVER_HELLO", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverHelloOpcode }, /*0x185*/ { "SMSG_QUESTGIVER_QUEST_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x186*/ { "CMSG_QUESTGIVER_QUERY_QUEST", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverQuestQueryOpcode}, - /*0x187*/ { "CMSG_QUESTGIVER_QUEST_AUTOLAUNCH", STATUS_LOGGEDIN, &WorldSession::HandleQuestAutoLaunch }, + /*0x186*/ { "CMSG_QUESTGIVER_QUERY_QUEST", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverQueryQuestOpcode}, + /*0x187*/ { "CMSG_QUESTGIVER_QUEST_AUTOLAUNCH", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverQuestAutoLaunch }, /*0x188*/ { "SMSG_QUESTGIVER_QUEST_DETAILS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x189*/ { "CMSG_QUESTGIVER_ACCEPT_QUEST", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverAcceptQuestOpcode}, - /*0x18A*/ { "CMSG_QUESTGIVER_COMPLETE_QUEST", STATUS_LOGGEDIN, &WorldSession::HandleQuestComplete }, + /*0x18A*/ { "CMSG_QUESTGIVER_COMPLETE_QUEST", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverCompleteQuest }, /*0x18B*/ { "SMSG_QUESTGIVER_REQUEST_ITEMS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x18C*/ { "CMSG_QUESTGIVER_REQUEST_REWARD", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverRequestRewardOpcode}, /*0x18D*/ { "SMSG_QUESTGIVER_OFFER_REWARD", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -441,7 +441,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x19A*/ { "SMSG_QUESTUPDATE_ADD_ITEM", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x19B*/ { "CMSG_QUEST_CONFIRM_ACCEPT", STATUS_LOGGEDIN, &WorldSession::HandleQuestConfirmAccept }, /*0x19C*/ { "SMSG_QUEST_CONFIRM_ACCEPT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x19D*/ { "CMSG_PUSHQUESTTOPARTY", STATUS_LOGGEDIN, &WorldSession::HandleQuestPushToParty }, + /*0x19D*/ { "CMSG_PUSHQUESTTOPARTY", STATUS_LOGGEDIN, &WorldSession::HandlePushQuestToParty }, /*0x19E*/ { "CMSG_LIST_INVENTORY", STATUS_LOGGEDIN, &WorldSession::HandleListInventoryOpcode }, /*0x19F*/ { "SMSG_LIST_INVENTORY", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x1A0*/ { "CMSG_SELL_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleSellItemOpcode }, @@ -494,7 +494,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x1CF*/ { "SMSG_QUERY_TIME_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x1D0*/ { "SMSG_LOG_XPGAIN", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x1D1*/ { "SMSG_AURACASTLOG", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x1D2*/ { "CMSG_RECLAIM_CORPSE", STATUS_LOGGEDIN, &WorldSession::HandleCorpseReclaimOpcode }, + /*0x1D2*/ { "CMSG_RECLAIM_CORPSE", STATUS_LOGGEDIN, &WorldSession::HandleReclaimCorpseOpcode }, /*0x1D3*/ { "CMSG_WRAP_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleWrapItemOpcode }, /*0x1D4*/ { "SMSG_LEVELUP_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x1D5*/ { "MSG_MINIMAP_PING", STATUS_LOGGEDIN, &WorldSession::HandleMinimapPingOpcode }, @@ -525,7 +525,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x1EE*/ { "SMSG_AUTH_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x1EF*/ { "MSG_GM_SHOWLABEL", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x1F0*/ { "CMSG_PET_CAST_SPELL", STATUS_LOGGEDIN, &WorldSession::HandlePetCastSpellOpcode }, - /*0x1F1*/ { "MSG_SAVE_GUILD_EMBLEM", STATUS_LOGGEDIN, &WorldSession::HandleGuildSaveEmblemOpcode }, + /*0x1F1*/ { "MSG_SAVE_GUILD_EMBLEM", STATUS_LOGGEDIN, &WorldSession::HandleSaveGuildEmblemOpcode }, /*0x1F2*/ { "MSG_TABARDVENDOR_ACTIVATE", STATUS_LOGGEDIN, &WorldSession::HandleTabardVendorActivateOpcode}, /*0x1F3*/ { "SMSG_PLAY_SPELL_VISUAL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x1F4*/ { "CMSG_ZONEUPDATE", STATUS_LOGGEDIN, &WorldSession::HandleZoneUpdateOpcode }, @@ -598,9 +598,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x237*/ { "CMSG_CLEAR_EXPLORATION", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x238*/ { "CMSG_SEND_MAIL", STATUS_LOGGEDIN, &WorldSession::HandleSendMail }, /*0x239*/ { "SMSG_SEND_MAIL_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x23A*/ { "CMSG_GET_MAIL_LIST", STATUS_LOGGEDIN, &WorldSession::HandleGetMail }, + /*0x23A*/ { "CMSG_GET_MAIL_LIST", STATUS_LOGGEDIN, &WorldSession::HandleGetMailList }, /*0x23B*/ { "SMSG_MAIL_LIST_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x23C*/ { "CMSG_BATTLEFIELD_LIST", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundListOpcode }, + /*0x23C*/ { "CMSG_BATTLEFIELD_LIST", STATUS_LOGGEDIN, &WorldSession::HandleBattlefieldListOpcode }, /*0x23D*/ { "SMSG_BATTLEFIELD_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x23E*/ { "CMSG_BATTLEFIELD_JOIN", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x23F*/ { "SMSG_BATTLEFIELD_WIN_OBSOLETE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -609,10 +609,10 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x242*/ { "CMSG_TAXIENABLENODE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x243*/ { "CMSG_ITEM_TEXT_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleItemTextQuery }, /*0x244*/ { "SMSG_ITEM_TEXT_QUERY_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x245*/ { "CMSG_MAIL_TAKE_MONEY", STATUS_LOGGEDIN, &WorldSession::HandleTakeMoney }, - /*0x246*/ { "CMSG_MAIL_TAKE_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleTakeItem }, - /*0x247*/ { "CMSG_MAIL_MARK_AS_READ", STATUS_LOGGEDIN, &WorldSession::HandleMarkAsRead }, - /*0x248*/ { "CMSG_MAIL_RETURN_TO_SENDER", STATUS_LOGGEDIN, &WorldSession::HandleReturnToSender }, + /*0x245*/ { "CMSG_MAIL_TAKE_MONEY", STATUS_LOGGEDIN, &WorldSession::HandleMailTakeMoney }, + /*0x246*/ { "CMSG_MAIL_TAKE_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleMailTakeItem }, + /*0x247*/ { "CMSG_MAIL_MARK_AS_READ", STATUS_LOGGEDIN, &WorldSession::HandleMailMarkAsRead }, + /*0x248*/ { "CMSG_MAIL_RETURN_TO_SENDER", STATUS_LOGGEDIN, &WorldSession::HandleMailReturnToSender }, /*0x249*/ { "CMSG_MAIL_DELETE", STATUS_LOGGEDIN, &WorldSession::HandleMailDelete }, /*0x24A*/ { "CMSG_MAIL_CREATE_TEXT_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleMailCreateTextItem }, /*0x24B*/ { "SMSG_SPELLLOGMISS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -672,7 +672,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x281*/ { "CMSG_RESET_FACTION_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x282*/ { "CMSG_AUTOSTORE_BANK_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleAutoStoreBankItemOpcode }, /*0x283*/ { "CMSG_AUTOBANK_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleAutoBankItemOpcode }, - /*0x284*/ { "MSG_QUERY_NEXT_MAIL_TIME", STATUS_LOGGEDIN, &WorldSession::HandleMsgQueryNextMailtime }, + /*0x284*/ { "MSG_QUERY_NEXT_MAIL_TIME", STATUS_LOGGEDIN, &WorldSession::HandleQueryNextMailTime }, /*0x285*/ { "SMSG_RECEIVED_MAIL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x286*/ { "SMSG_RAID_GROUP_ONLY", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x287*/ { "CMSG_SET_DURABILITY_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -682,8 +682,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x28B*/ { "CMSG_SET_PVP_TITLE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x28C*/ { "SMSG_PVP_CREDIT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x28D*/ { "SMSG_AUCTION_REMOVED_NOTIFICATION", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x28E*/ { "CMSG_GROUP_RAID_CONVERT", STATUS_LOGGEDIN, &WorldSession::HandleRaidConvertOpcode }, - /*0x28F*/ { "CMSG_GROUP_ASSISTANT_LEADER", STATUS_LOGGEDIN, &WorldSession::HandleGroupAssistantOpcode }, + /*0x28E*/ { "CMSG_GROUP_RAID_CONVERT", STATUS_LOGGEDIN, &WorldSession::HandleGroupRaidConvertOpcode }, + /*0x28F*/ { "CMSG_GROUP_ASSISTANT_LEADER", STATUS_LOGGEDIN, &WorldSession::HandleGroupAssistantLeaderOpcode}, /*0x290*/ { "CMSG_BUYBACK_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleBuybackItem }, /*0x291*/ { "SMSG_SERVER_MESSAGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x292*/ { "CMSG_MEETINGSTONE_JOIN", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -710,7 +710,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2A7*/ { "SMSG_GAMEOBJECT_RESET_STATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2A8*/ { "CMSG_REPAIR_ITEM", STATUS_LOGGEDIN, &WorldSession::HandleRepairItemOpcode }, /*0x2A9*/ { "SMSG_CHAT_PLAYER_NOT_FOUND", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x2AA*/ { "MSG_TALENT_WIPE_CONFIRM", STATUS_LOGGEDIN, &WorldSession::HandleTalentWipeOpcode }, + /*0x2AA*/ { "MSG_TALENT_WIPE_CONFIRM", STATUS_LOGGEDIN, &WorldSession::HandleTalentWipeConfirmOpcode }, /*0x2AB*/ { "SMSG_SUMMON_REQUEST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2AC*/ { "CMSG_SUMMON_RESPONSE", STATUS_LOGGEDIN, &WorldSession::HandleSummonResponseOpcode }, /*0x2AD*/ { "MSG_MOVE_TOGGLE_GRAVITY_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -725,13 +725,13 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2B6*/ { "SMSG_SCRIPT_MESSAGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2B7*/ { "SMSG_DUEL_COUNTDOWN", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2B8*/ { "SMSG_AREA_TRIGGER_MESSAGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x2B9*/ { "CMSG_SHOWING_HELM", STATUS_LOGGEDIN, &WorldSession::HandleToggleHelmOpcode }, - /*0x2BA*/ { "CMSG_SHOWING_CLOAK", STATUS_LOGGEDIN, &WorldSession::HandleToggleCloakOpcode }, + /*0x2B9*/ { "CMSG_SHOWING_HELM", STATUS_LOGGEDIN, &WorldSession::HandleShowingHelmOpcode }, + /*0x2BA*/ { "CMSG_SHOWING_CLOAK", STATUS_LOGGEDIN, &WorldSession::HandleShowingCloakOpcode }, /*0x2BB*/ { "SMSG_MEETINGSTONE_JOINFAILED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2BC*/ { "SMSG_PLAYER_SKINNED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2BD*/ { "SMSG_DURABILITY_DAMAGE_DEATH", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2BE*/ { "CMSG_SET_EXPLORATION", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x2BF*/ { "CMSG_SET_ACTIONBAR_TOGGLES", STATUS_AUTHED, &WorldSession::HandleSetActionBar }, + /*0x2BF*/ { "CMSG_SET_ACTIONBAR_TOGGLES", STATUS_AUTHED, &WorldSession::HandleSetActionBarToggles }, /*0x2C0*/ { "UMSG_DELETE_GUILD_CHARTER", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x2C1*/ { "MSG_PETITION_RENAME", STATUS_LOGGEDIN, &WorldSession::HandlePetitionRenameOpcode }, /*0x2C2*/ { "SMSG_INIT_WORLD_STATES", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -739,9 +739,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2C4*/ { "CMSG_ITEM_NAME_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleItemNameQueryOpcode }, /*0x2C5*/ { "SMSG_ITEM_NAME_QUERY_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2C6*/ { "SMSG_PET_ACTION_FEEDBACK", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x2C7*/ { "CMSG_CHAR_RENAME", STATUS_AUTHED, &WorldSession::HandleChangePlayerNameOpcode }, + /*0x2C7*/ { "CMSG_CHAR_RENAME", STATUS_AUTHED, &WorldSession::HandleCharRenameOpcode }, /*0x2C8*/ { "SMSG_CHAR_RENAME", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x2C9*/ { "CMSG_MOVE_SPLINE_DONE", STATUS_LOGGEDIN, &WorldSession::HandleTaxiNextDestinationOpcode }, + /*0x2C9*/ { "CMSG_MOVE_SPLINE_DONE", STATUS_LOGGEDIN, &WorldSession::HandleMoveSplineDoneOpcode }, /*0x2CA*/ { "CMSG_MOVE_FALL_RESET", STATUS_LOGGEDIN, &WorldSession::HandleMovementOpcodes }, /*0x2CB*/ { "SMSG_INSTANCE_SAVE_CREATED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2CC*/ { "SMSG_RAID_INSTANCE_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -753,9 +753,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2D2*/ { "SMSG_PLAY_SOUND", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2D3*/ { "CMSG_BATTLEFIELD_STATUS", STATUS_LOGGEDIN, &WorldSession::HandleBattlefieldStatusOpcode }, /*0x2D4*/ { "SMSG_BATTLEFIELD_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x2D5*/ { "CMSG_BATTLEFIELD_PORT", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundPlayerPortOpcode}, + /*0x2D5*/ { "CMSG_BATTLEFIELD_PORT", STATUS_LOGGEDIN, &WorldSession::HandleBattleFieldPortOpcode }, /*0x2D6*/ { "MSG_INSPECT_HONOR_STATS", STATUS_LOGGEDIN, &WorldSession::HandleInspectHonorStatsOpcode }, - /*0x2D7*/ { "CMSG_BATTLEMASTER_HELLO", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundHelloOpcode }, + /*0x2D7*/ { "CMSG_BATTLEMASTER_HELLO", STATUS_LOGGEDIN, &WorldSession::HandleBattlemasterHelloOpcode }, /*0x2D8*/ { "CMSG_MOVE_START_SWIM_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x2D9*/ { "CMSG_MOVE_STOP_SWIM_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x2DA*/ { "SMSG_FORCE_WALK_SPEED_CHANGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -764,8 +764,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2DD*/ { "CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK", STATUS_LOGGEDIN, &WorldSession::HandleForceSpeedChangeAck }, /*0x2DE*/ { "SMSG_FORCE_TURN_RATE_CHANGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2DF*/ { "CMSG_FORCE_TURN_RATE_CHANGE_ACK", STATUS_LOGGEDIN, &WorldSession::HandleForceSpeedChangeAck }, - /*0x2E0*/ { "MSG_PVP_LOG_DATA", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundPVPlogdataOpcode}, - /*0x2E1*/ { "CMSG_LEAVE_BATTLEFIELD", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundLeaveOpcode }, + /*0x2E0*/ { "MSG_PVP_LOG_DATA", STATUS_LOGGEDIN, &WorldSession::HandlePVPLogDataOpcode }, + /*0x2E1*/ { "CMSG_LEAVE_BATTLEFIELD", STATUS_LOGGEDIN, &WorldSession::HandleLeaveBattlefieldOpcode }, /*0x2E2*/ { "CMSG_AREA_SPIRIT_HEALER_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleAreaSpiritHealerQueryOpcode}, /*0x2E3*/ { "CMSG_AREA_SPIRIT_HEALER_QUEUE", STATUS_LOGGEDIN, &WorldSession::HandleAreaSpiritHealerQueueOpcode}, /*0x2E4*/ { "SMSG_AREA_SPIRIT_HEALER_TIME", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -778,7 +778,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2EB*/ { "SMSG_BINDER_CONFIRM", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2EC*/ { "SMSG_BATTLEGROUND_PLAYER_JOINED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2ED*/ { "SMSG_BATTLEGROUND_PLAYER_LEFT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x2EE*/ { "CMSG_BATTLEMASTER_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundJoinOpcode }, + /*0x2EE*/ { "CMSG_BATTLEMASTER_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleBattlemasterJoinOpcode }, /*0x2EF*/ { "SMSG_ADDON_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2F0*/ { "CMSG_PET_UNLEARN", STATUS_LOGGEDIN, &WorldSession::HandlePetUnlearnOpcode }, /*0x2F1*/ { "SMSG_PET_UNLEARN_CONFIRM", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -792,7 +792,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2F9*/ { "SMSG_MINIGAME_MOVE_FAILED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2FA*/ { "SMSG_RAID_INSTANCE_MESSAGE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2FB*/ { "SMSG_COMPRESSED_MOVES", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x2FC*/ { "CMSG_GUILD_INFO_TEXT", STATUS_LOGGEDIN, &WorldSession::HandleGuildChangeInfoOpcode }, + /*0x2FC*/ { "CMSG_GUILD_INFO_TEXT", STATUS_LOGGEDIN, &WorldSession::HandleGuildChangeInfoTextOpcode }, /*0x2FD*/ { "SMSG_CHAT_RESTRICTED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2FE*/ { "SMSG_SPLINE_SET_RUN_SPEED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2FF*/ { "SMSG_SPLINE_SET_RUN_BACK_SPEED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -814,13 +814,13 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x30F*/ { "CMSG_GM_NUKE_ACCOUNT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x310*/ { "MSG_GM_DESTROY_CORPSE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x311*/ { "CMSG_GM_DESTROY_ONLINE_CORPSE", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x312*/ { "CMSG_ACTIVATETAXIEXPRESS", STATUS_LOGGEDIN, &WorldSession::HandleActivateTaxiFarOpcode }, + /*0x312*/ { "CMSG_ACTIVATETAXIEXPRESS", STATUS_LOGGEDIN, &WorldSession::HandleActivateTaxiExpressOpcode }, /*0x313*/ { "SMSG_SET_FACTION_ATWAR", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x314*/ { "SMSG_GAMETIMEBIAS_SET", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x315*/ { "CMSG_DEBUG_ACTIONS_START", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x316*/ { "CMSG_DEBUG_ACTIONS_STOP", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x317*/ { "CMSG_SET_FACTION_INACTIVE", STATUS_LOGGEDIN, &WorldSession::HandleSetWatchedFactionInactiveOpcode}, - /*0x318*/ { "CMSG_SET_WATCHED_FACTION", STATUS_LOGGEDIN, &WorldSession::HandleSetWatchedFactionIndexOpcode}, + /*0x317*/ { "CMSG_SET_FACTION_INACTIVE", STATUS_LOGGEDIN, &WorldSession::HandleSetFactionInactiveOpcode }, + /*0x318*/ { "CMSG_SET_WATCHED_FACTION", STATUS_LOGGEDIN, &WorldSession::HandleSetWatchedFactionOpcode }, /*0x319*/ { "MSG_MOVE_TIME_SKIPPED", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x31A*/ { "SMSG_SPLINE_MOVE_ROOT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x31B*/ { "CMSG_SET_EXPLORATION_ALL", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -829,7 +829,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x31E*/ { "SMSG_INSTANCE_RESET", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x31F*/ { "SMSG_INSTANCE_RESET_FAILED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x320*/ { "SMSG_UPDATE_LAST_INSTANCE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x321*/ { "MSG_RAID_TARGET_UPDATE", STATUS_LOGGEDIN, &WorldSession::HandleRaidIconTargetOpcode }, + /*0x321*/ { "MSG_RAID_TARGET_UPDATE", STATUS_LOGGEDIN, &WorldSession::HandleRaidTargetUpdateOpcode }, /*0x322*/ { "MSG_RAID_READY_CHECK", STATUS_LOGGEDIN, &WorldSession::HandleRaidReadyCheckOpcode }, /*0x323*/ { "CMSG_LUA_USAGE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x324*/ { "SMSG_PET_ACTION_SOUND", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -837,7 +837,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x326*/ { "SMSG_GHOSTEE_GONE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x327*/ { "CMSG_GM_UPDATE_TICKET_STATUS", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x328*/ { "SMSG_GM_TICKET_STATUS_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x329*/ { "MSG_SET_DUNGEON_DIFFICULTY", STATUS_LOGGEDIN, &WorldSession::HandleDungeonDifficultyOpcode }, + /*0x329*/ { "MSG_SET_DUNGEON_DIFFICULTY", STATUS_LOGGEDIN, &WorldSession::HandleSetDungeonDifficultyOpcode}, /*0x32A*/ { "CMSG_GMSURVEY_SUBMIT", STATUS_NEVER, &WorldSession::Handle_NULL },//LOGGEDIN, &WorldSession::HandleGMSurveySubmit }, /*0x32B*/ { "SMSG_UPDATE_INSTANCE_OWNERSHIP", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x32C*/ { "CMSG_IGNORE_KNOCKBACK_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -865,7 +865,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x342*/ { "MSG_MOVE_STOP_SWIM_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x343*/ { "SMSG_MOVE_SET_CAN_FLY", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x344*/ { "SMSG_MOVE_UNSET_CAN_FLY", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x345*/ { "CMSG_MOVE_SET_CAN_FLY_ACK", STATUS_LOGGEDIN, &WorldSession::HandleMoveFlyModeChangeAckOpcode}, + /*0x345*/ { "CMSG_MOVE_SET_CAN_FLY_ACK", STATUS_LOGGEDIN, &WorldSession::HandleMoveSetCanFlyAckOpcode }, /*0x346*/ { "CMSG_MOVE_SET_FLY", STATUS_LOGGEDIN, &WorldSession::HandleMovementOpcodes }, /*0x347*/ { "CMSG_SOCKET_GEMS", STATUS_LOGGEDIN, &WorldSession::HandleSocketOpcode }, /*0x348*/ { "CMSG_ARENA_TEAM_CREATE", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -875,30 +875,30 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x34C*/ { "SMSG_ARENA_TEAM_QUERY_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x34D*/ { "CMSG_ARENA_TEAM_ROSTER", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamRosterOpcode }, /*0x34E*/ { "SMSG_ARENA_TEAM_ROSTER", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x34F*/ { "CMSG_ARENA_TEAM_INVITE", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamAddMemberOpcode }, + /*0x34F*/ { "CMSG_ARENA_TEAM_INVITE", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamInviteOpcode }, /*0x350*/ { "SMSG_ARENA_TEAM_INVITE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x351*/ { "CMSG_ARENA_TEAM_ACCEPT", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamInviteAcceptOpcode}, - /*0x352*/ { "CMSG_ARENA_TEAM_DECLINE", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamInviteDeclineOpcode}, + /*0x351*/ { "CMSG_ARENA_TEAM_ACCEPT", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamAcceptOpcode }, + /*0x352*/ { "CMSG_ARENA_TEAM_DECLINE", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamDeclineOpcode }, /*0x353*/ { "CMSG_ARENA_TEAM_LEAVE", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamLeaveOpcode }, - /*0x354*/ { "CMSG_ARENA_TEAM_REMOVE", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamRemoveFromTeamOpcode}, + /*0x354*/ { "CMSG_ARENA_TEAM_REMOVE", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamRemoveOpcode }, /*0x355*/ { "CMSG_ARENA_TEAM_DISBAND", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamDisbandOpcode }, - /*0x356*/ { "CMSG_ARENA_TEAM_LEADER", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamPromoteToCaptainOpcode}, + /*0x356*/ { "CMSG_ARENA_TEAM_LEADER", STATUS_LOGGEDIN, &WorldSession::HandleArenaTeamLeaderOpcode }, /*0x357*/ { "SMSG_ARENA_TEAM_EVENT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x358*/ { "CMSG_BATTLEMASTER_JOIN_ARENA", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundArenaJoin }, + /*0x358*/ { "CMSG_BATTLEMASTER_JOIN_ARENA", STATUS_LOGGEDIN, &WorldSession::HandleBattlemasterJoinArena }, /*0x359*/ { "MSG_MOVE_START_ASCEND", STATUS_LOGGEDIN, &WorldSession::HandleMovementOpcodes }, /*0x35A*/ { "MSG_MOVE_STOP_ASCEND", STATUS_LOGGEDIN, &WorldSession::HandleMovementOpcodes }, /*0x35B*/ { "SMSG_ARENA_TEAM_STATS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x35C*/ { "CMSG_LFG_SET_AUTOJOIN", STATUS_AUTHED, &WorldSession::HandleLfgAutoJoinOpcode }, - /*0x35D*/ { "CMSG_LFG_CLEAR_AUTOJOIN", STATUS_LOGGEDIN, &WorldSession::HandleLfgCancelAutoJoinOpcode }, - /*0x35E*/ { "CMSG_LFM_SET_AUTOFILL", STATUS_AUTHED, &WorldSession::HandleLfmAutoAddMembersOpcode }, - /*0x35F*/ { "CMSG_LFM_CLEAR_AUTOFILL", STATUS_LOGGEDIN, &WorldSession::HandleLfmCancelAutoAddmembersOpcode}, + /*0x35C*/ { "CMSG_LFG_SET_AUTOJOIN", STATUS_AUTHED, &WorldSession::HandleLfgSetAutoJoinOpcode }, + /*0x35D*/ { "CMSG_LFG_CLEAR_AUTOJOIN", STATUS_LOGGEDIN, &WorldSession::HandleLfgClearAutoJoinOpcode }, + /*0x35E*/ { "CMSG_LFM_SET_AUTOFILL", STATUS_AUTHED, &WorldSession::HandleLfmSetAutoFillOpcode }, + /*0x35F*/ { "CMSG_LFM_CLEAR_AUTOFILL", STATUS_LOGGEDIN, &WorldSession::HandleLfmClearAutoFillOpcode }, /*0x360*/ { "CMSG_ACCEPT_LFG_MATCH", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x361*/ { "CMSG_DECLINE_LFG_MATCH", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x362*/ { "CMSG_CANCEL_PENDING_LFG", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x363*/ { "CMSG_CLEAR_LOOKING_FOR_GROUP", STATUS_LOGGEDIN, &WorldSession::HandleLfgClearOpcode }, - /*0x364*/ { "CMSG_CLEAR_LOOKING_FOR_MORE", STATUS_LOGGEDIN, &WorldSession::HandleLfmSetNoneOpcode }, - /*0x365*/ { "CMSG_SET_LOOKING_FOR_MORE", STATUS_LOGGEDIN, &WorldSession::HandleLfmSetOpcode }, - /*0x366*/ { "CMSG_SET_LFG_COMMENT", STATUS_LOGGEDIN, &WorldSession::HandleLfgSetCommentOpcode }, + /*0x364*/ { "CMSG_CLEAR_LOOKING_FOR_MORE", STATUS_LOGGEDIN, &WorldSession::HandleLfmClearOpcode }, + /*0x365*/ { "CMSG_SET_LOOKING_FOR_MORE", STATUS_LOGGEDIN, &WorldSession::HandleSetLfmOpcode }, + /*0x366*/ { "CMSG_SET_LFG_COMMENT", STATUS_LOGGEDIN, &WorldSession::HandleSetLfgCommentOpcode }, /*0x367*/ { "SMSG_LFG_TIMEDOUT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x368*/ { "SMSG_LFG_OTHER_TIMEDOUT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x369*/ { "SMSG_LFG_AUTOJOIN_FAILED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -912,12 +912,12 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x371*/ { "SMSG_LFG_PENDING_MATCH", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x372*/ { "SMSG_LFG_PENDING_MATCH_DONE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x373*/ { "SMSG_TITLE_EARNED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x374*/ { "CMSG_SET_TITLE", STATUS_LOGGEDIN, &WorldSession::HandleChooseTitleOpcode }, - /*0x375*/ { "CMSG_CANCEL_MOUNT_AURA", STATUS_LOGGEDIN, &WorldSession::HandleDismountOpcode }, + /*0x374*/ { "CMSG_SET_TITLE", STATUS_LOGGEDIN, &WorldSession::HandleSetTitleOpcode }, + /*0x375*/ { "CMSG_CANCEL_MOUNT_AURA", STATUS_LOGGEDIN, &WorldSession::HandleCancelMountAuraOpcode }, /*0x376*/ { "SMSG_ARENA_ERROR", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x377*/ { "MSG_INSPECT_ARENA_TEAMS", STATUS_LOGGEDIN, &WorldSession::HandleInspectArenaStatsOpcode }, + /*0x377*/ { "MSG_INSPECT_ARENA_TEAMS", STATUS_LOGGEDIN, &WorldSession::HandleInspectArenaTeamsOpcode }, /*0x378*/ { "SMSG_DEATH_RELEASE_LOC", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x379*/ { "CMSG_CANCEL_TEMP_ENCHANTMENT", STATUS_LOGGEDIN, &WorldSession::HandleCancelTempItemEnchantmentOpcode}, + /*0x379*/ { "CMSG_CANCEL_TEMP_ENCHANTMENT", STATUS_LOGGEDIN, &WorldSession::HandleCancelTempEnchantmentOpcode}, /*0x37A*/ { "SMSG_FORCED_DEATH_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x37B*/ { "CMSG_CHEAT_SET_HONOR_CURRENCY", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x37C*/ { "CMSG_CHEAT_SET_ARENA_CURRENCY", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -936,9 +936,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x389*/ { "CMSG_SET_TAXI_BENCHMARK_MODE", STATUS_AUTHED, &WorldSession::HandleSetTaxiBenchmarkOpcode }, /*0x38A*/ { "SMSG_JOINED_BATTLEGROUND_QUEUE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x38B*/ { "SMSG_REALM_SPLIT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x38C*/ { "CMSG_REALM_SPLIT", STATUS_AUTHED, &WorldSession::HandleRealmStateRequestOpcode }, + /*0x38C*/ { "CMSG_REALM_SPLIT", STATUS_AUTHED, &WorldSession::HandleRealmSplitOpcode }, /*0x38D*/ { "CMSG_MOVE_CHNG_TRANSPORT", STATUS_LOGGEDIN, &WorldSession::HandleMovementOpcodes }, - /*0x38E*/ { "MSG_PARTY_ASSIGNMENT", STATUS_LOGGEDIN, &WorldSession::HandleGroupPromoteOpcode }, + /*0x38E*/ { "MSG_PARTY_ASSIGNMENT", STATUS_LOGGEDIN, &WorldSession::HandlePartyAssignmentOpcode }, /*0x38F*/ { "SMSG_OFFER_PETITION_ERROR", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x390*/ { "SMSG_TIME_SYNC_REQ", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x391*/ { "CMSG_TIME_SYNC_RESP", STATUS_LOGGEDIN, &WorldSession::HandleTimeSyncResp }, @@ -971,7 +971,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3AC*/ { "SMSG_DISMOUNT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3AD*/ { "MSG_MOVE_UPDATE_CAN_FLY", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3AE*/ { "MSG_RAID_READY_CHECK_CONFIRM", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x3AF*/ { "CMSG_VOICE_SESSION_ENABLE", STATUS_AUTHED, &WorldSession::HandleVoiceSettingsOpcode }, + /*0x3AF*/ { "CMSG_VOICE_SESSION_ENABLE", STATUS_AUTHED, &WorldSession::HandleVoiceSessionEnableOpcode }, /*0x3B0*/ { "SMSG_VOICE_SESSION_ENABLE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3B1*/ { "SMSG_VOICE_PARENTAL_CONTROLS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3B2*/ { "CMSG_GM_WHISPER", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -994,8 +994,8 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3C3*/ { "CMSG_CHEAT_PLAYER_LOOKUP", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3C4*/ { "SMSG_CHEAT_PLAYER_LOOKUP", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3C5*/ { "SMSG_KICK_REASON", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x3C6*/ { "MSG_RAID_READY_CHECK_FINISHED", STATUS_LOGGEDIN, &WorldSession::HandleRaidReadyCheckFinishOpcode}, - /*0x3C7*/ { "CMSG_COMPLAIN", STATUS_LOGGEDIN, &WorldSession::HandleReportSpamOpcode }, + /*0x3C6*/ { "MSG_RAID_READY_CHECK_FINISHED", STATUS_LOGGEDIN, &WorldSession::HandleRaidReadyCheckFinishedOpcode}, + /*0x3C7*/ { "CMSG_COMPLAIN", STATUS_LOGGEDIN, &WorldSession::HandleComplainOpcode }, /*0x3C8*/ { "SMSG_COMPLAIN_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3C9*/ { "SMSG_FEATURE_SYSTEM_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3CA*/ { "CMSG_GM_SHOW_COMPLAINTS", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -1006,11 +1006,11 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3CF*/ { "CMSG_CHANNEL_UNSILENCE_ALL", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3D0*/ { "CMSG_TARGET_CAST", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3D1*/ { "CMSG_TARGET_SCRIPT_CAST", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x3D2*/ { "CMSG_CHANNEL_DISPLAY_LIST", STATUS_LOGGEDIN, &WorldSession::HandleChannelRosterQuery }, - /*0x3D3*/ { "CMSG_SET_ACTIVE_VOICE_CHANNEL", STATUS_AUTHED, &WorldSession::HandleChannelVoiceChatQuery }, - /*0x3D4*/ { "CMSG_GET_CHANNEL_MEMBER_COUNT", STATUS_LOGGEDIN, &WorldSession::HandleChannelInfoQuery }, + /*0x3D2*/ { "CMSG_CHANNEL_DISPLAY_LIST", STATUS_LOGGEDIN, &WorldSession::HandleChannelDisplayListQuery }, + /*0x3D3*/ { "CMSG_SET_ACTIVE_VOICE_CHANNEL", STATUS_AUTHED, &WorldSession::HandleSetActiveVoiceChannel }, + /*0x3D4*/ { "CMSG_GET_CHANNEL_MEMBER_COUNT", STATUS_LOGGEDIN, &WorldSession::HandleGetChannelMemberCount }, /*0x3D5*/ { "SMSG_CHANNEL_MEMBER_COUNT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x3D6*/ { "CMSG_CHANNEL_VOICE_ON", STATUS_LOGGEDIN, &WorldSession::HandleChannelEnableVoiceOpcode }, + /*0x3D6*/ { "CMSG_CHANNEL_VOICE_ON", STATUS_LOGGEDIN, &WorldSession::HandleChannelVoiceOnOpcode }, /*0x3D7*/ { "CMSG_CHANNEL_VOICE_OFF", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3D8*/ { "CMSG_DEBUG_LIST_TARGETS", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3D9*/ { "SMSG_DEBUG_LIST_TARGETS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -1024,18 +1024,18 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3E1*/ { "SMSG_COMSAT_DISCONNECT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3E2*/ { "SMSG_COMSAT_CONNECT_FAIL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3E3*/ { "SMSG_VOICE_CHAT_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, &WorldSession::HandleBattleGroundReportAFK }, + /*0x3E4*/ { "CMSG_REPORT_PVP_AFK", STATUS_LOGGEDIN, &WorldSession::HandleReportPvPAFK }, /*0x3E5*/ { "CMSG_REPORT_PVP_AFK_RESULT", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankQuery }, - /*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankTabColon }, + /*0x3E6*/ { "CMSG_GUILD_BANKER_ACTIVATE", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankerActivate }, + /*0x3E7*/ { "CMSG_GUILD_BANK_QUERY_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankQueryTab }, /*0x3E8*/ { "SMSG_GUILD_BANK_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x3E9*/ { "CMSG_GUILD_BANK_SWAP_ITEMS", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankDepositItem }, + /*0x3E9*/ { "CMSG_GUILD_BANK_SWAP_ITEMS", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankSwapItems }, /*0x3EA*/ { "CMSG_GUILD_BANK_BUY_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankBuyTab }, - /*0x3EB*/ { "CMSG_GUILD_BANK_UPDATE_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankModifyTab }, - /*0x3EC*/ { "CMSG_GUILD_BANK_DEPOSIT_MONEY", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankDeposit }, - /*0x3ED*/ { "CMSG_GUILD_BANK_WITHDRAW_MONEY", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankWithdraw }, - /*0x3EE*/ { "MSG_GUILD_BANK_LOG_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankLog }, - /*0x3EF*/ { "CMSG_SET_CHANNEL_WATCH", STATUS_LOGGEDIN, &WorldSession::HandleChannelJoinNotify }, + /*0x3EB*/ { "CMSG_GUILD_BANK_UPDATE_TAB", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankUpdateTab }, + /*0x3EC*/ { "CMSG_GUILD_BANK_DEPOSIT_MONEY", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankDepositMoney }, + /*0x3ED*/ { "CMSG_GUILD_BANK_WITHDRAW_MONEY", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankWithdrawMoney }, + /*0x3EE*/ { "MSG_GUILD_BANK_LOG_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankLogQuery }, + /*0x3EF*/ { "CMSG_SET_CHANNEL_WATCH", STATUS_LOGGEDIN, &WorldSession::HandleSetChannelWatch }, /*0x3F0*/ { "SMSG_USERLIST_ADD", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3F1*/ { "SMSG_USERLIST_REMOVE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x3F2*/ { "SMSG_USERLIST_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -1049,9 +1049,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x3FA*/ { "CMSG_GM_CHARACTER_RESTORE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3FB*/ { "CMSG_GM_CHARACTER_SAVE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x3FC*/ { "SMSG_VOICESESSION_FULL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x3FD*/ { "MSG_GUILD_PERMISSIONS", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankGetRights }, - /*0x3FE*/ { "MSG_GUILD_BANK_MONEY_WITHDRAWN", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankGetMoneyAmount }, - /*0x3FF*/ { "MSG_GUILD_EVENT_LOG_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleGuildEventLogOpcode }, + /*0x3FD*/ { "MSG_GUILD_PERMISSIONS", STATUS_LOGGEDIN, &WorldSession::HandleGuildPermissions }, + /*0x3FE*/ { "MSG_GUILD_BANK_MONEY_WITHDRAWN", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankMoneyWithdrawn }, + /*0x3FF*/ { "MSG_GUILD_EVENT_LOG_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleGuildEventLogQueryOpcode }, /*0x400*/ { "CMSG_MAELSTROM_RENAME_GUILD", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x401*/ { "CMSG_GET_MIRRORIMAGE_DATA", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x402*/ { "SMSG_MIRRORIMAGE_DATA", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -1061,9 +1061,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x406*/ { "SMSG_IGNORE_DIMINISHING_RETURNS_CHEAT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x407*/ { "CMSG_KEEP_ALIVE", STATUS_NEVER, &WorldSession::Handle_EarlyProccess }, /*0x408*/ { "SMSG_RAID_READY_CHECK_ERROR", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x409*/ { "CMSG_OPT_OUT_OF_LOOT", STATUS_AUTHED, &WorldSession::HandleGroupPassOnLootOpcode }, - /*0x40A*/ { "MSG_QUERY_GUILD_BANK_TEXT", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankTabText }, - /*0x40B*/ { "CMSG_SET_GUILD_BANK_TEXT", STATUS_LOGGEDIN, &WorldSession::HandleGuildBankSetTabText }, + /*0x409*/ { "CMSG_OPT_OUT_OF_LOOT", STATUS_AUTHED, &WorldSession::HandleOptOutOfLootOpcode }, + /*0x40A*/ { "MSG_QUERY_GUILD_BANK_TEXT", STATUS_LOGGEDIN, &WorldSession::HandleQueryGuildBankTabText }, + /*0x40B*/ { "CMSG_SET_GUILD_BANK_TEXT", STATUS_LOGGEDIN, &WorldSession::HandleSetGuildBankTabText }, /*0x40C*/ { "CMSG_SET_GRANTABLE_LEVELS", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x40D*/ { "CMSG_GRANT_LEVEL", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x40E*/ { "CMSG_REFER_A_FRIEND", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -1072,12 +1072,12 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x411*/ { "CMSG_GROUPACTION_THROTTLED", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x412*/ { "SMSG_OVERRIDE_LIGHT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x413*/ { "SMSG_TOTEM_CREATED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x414*/ { "CMSG_TOTEM_DESTROYED", STATUS_LOGGEDIN, &WorldSession::HandleTotemDestroy }, + /*0x414*/ { "CMSG_TOTEM_DESTROYED", STATUS_LOGGEDIN, &WorldSession::HandleTotemDestroyed }, /*0x415*/ { "CMSG_EXPIRE_RAID_INSTANCE", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x416*/ { "CMSG_NO_SPELL_VARIANCE", STATUS_NEVER, &WorldSession::Handle_NULL }, - /*0x417*/ { "CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverStatusQueryMultipleOpcode}, + /*0x417*/ { "CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY", STATUS_LOGGEDIN, &WorldSession::HandleQuestgiverStatusMultipleQuery}, /*0x418*/ { "SMSG_QUESTGIVER_STATUS_MULTIPLE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x419*/ { "CMSG_SET_PLAYER_DECLINED_NAMES", STATUS_AUTHED, &WorldSession::HandleDeclinedPlayerNameOpcode }, + /*0x419*/ { "CMSG_SET_PLAYER_DECLINED_NAMES", STATUS_AUTHED, &WorldSession::HandleSetPlayerDeclinedNames }, /*0x41A*/ { "SMSG_SET_PLAYER_DECLINED_NAMES_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x41B*/ { "CMSG_QUERY_SERVER_BUCK_DATA", STATUS_NEVER, &WorldSession::Handle_NULL }, /*0x41C*/ { "CMSG_CLEAR_SERVER_BUCK_DATA", STATUS_NEVER, &WorldSession::Handle_NULL }, @@ -1159,7 +1159,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x468*/ { "SMSG_ACHIEVEMENT_EARNED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x469*/ { "SMSG_DYNAMIC_DROP_ROLL_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x46A*/ { "SMSG_CRITERIA_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x46B*/ { "CMSG_QUERY_INSPECT_ACHIEVEMENTS", STATUS_LOGGEDIN, &WorldSession::HandleInspectAchievements }, + /*0x46B*/ { "CMSG_QUERY_INSPECT_ACHIEVEMENTS", STATUS_LOGGEDIN, &WorldSession::HandleQueryInspectAchievements }, /*0x46C*/ { "SMSG_RESPOND_INSPECT_ACHIEVEMENTS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x46D*/ { "CMSG_DISMISS_CONTROLLED_VEHICLE", STATUS_LOGGEDIN, &WorldSession::HandleDismissControlledVehicle }, /*0x46E*/ { "CMSG_COMPLETE_ACHIEVEMENT_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL }, diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index d57cfd62852..fbf3e9a72a1 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1241,7 +1241,7 @@ enum SessionStatus { STATUS_AUTHED = 0, ///< Player authenticated STATUS_LOGGEDIN, ///< Player in game - STATUS_TRANSFER_PENDING, ///< Player transferring to another map + STATUS_TRANSFER, ///< Player transferring to another map STATUS_NEVER ///< Opcode not accepted from client (deprecated or server side only) }; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 5f89d71ff53..d2bef6ddba7 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1035,7 +1035,7 @@ void Pet::_SaveSpellCooldowns() m_CreatureSpellCooldowns.erase(itr++); else { - CharacterDatabase.PExecute("INSERT INTO pet_spell_cooldown (guid,spell,time) VALUES ('%u', '%u', '" I64FMTD "')", m_charmInfo->GetPetNumber(), itr->first, uint64(itr->second)); + CharacterDatabase.PExecute("INSERT INTO pet_spell_cooldown (guid,spell,time) VALUES ('%u', '%u', '" UI64FMTD "')", m_charmInfo->GetPetNumber(), itr->first, uint64(itr->second)); ++itr; } } @@ -1186,7 +1186,7 @@ void Pet::_SaveAuras() } CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2,maxduration,remaintime,remaincharges) " - "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%u')", + "VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%u')", m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(), itr->second->GetId(), (uint32)itr->second->GetEffectMask(), (int32)itr->second->GetStackAmount(), amounts[0], amounts[1], amounts[2] ,itr->second->GetAuraMaxDuration(), itr->second->GetAuraDuration(), (uint32)itr->second->GetAuraCharges()); diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index de558c5435a..d6ffb51f74d 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -83,7 +83,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetAction: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -380,7 +380,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetSetAction: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -550,7 +550,7 @@ void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket) CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetUnlearnOpcode: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetUnlearnOpcode: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } pet->resetTalents(); @@ -588,7 +588,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ) CharmInfo *charmInfo = pet->GetCharmInfo(); if(!charmInfo) { - sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object "I64FMTD" is considered pet-like but doesn't have a charminfo!", pet->GetGUID()); + sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 2e96a13dc61..ad7635d39de 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1536,7 +1536,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) const ItemPrototype * proto = objmgr.GetItemPrototype(item_id); SpellItemEnchantmentEntry const *enchant = NULL; - for(uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot<=TEMP_ENCHANTMENT_SLOT; enchantSlot++) + for(uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot <= TEMP_ENCHANTMENT_SLOT; ++enchantSlot) { uint32 enchantId = GetUInt32Value(visualbase+1+enchantSlot); if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)) @@ -3071,7 +3071,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const switch(spellInfo->Id) { - // some spells not have stance data expacted cast at form change or present + // some spells not have stance data expected cast at form change or present case 5420: need_cast = (m_form == FORM_TREE); break; case 5419: need_cast = (m_form == FORM_TRAVEL); break; case 7376: need_cast = (m_form == FORM_DEFENSIVESTANCE); break; @@ -3318,7 +3318,7 @@ void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ ) if(update) { - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(spell_id); data << uint64(GetGUID()); SendDirectMessage(&data); @@ -3349,7 +3349,7 @@ void Player::RemoveArenaSpellCooldowns() entry->CategoryRecoveryTime <= 15 * MINUTE * IN_MILISECONDS ) { // notify player - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(itr->first); data << uint64(GetGUID()); GetSession()->SendPacket(&data); @@ -3365,7 +3365,7 @@ void Player::RemoveAllSpellCooldown() { for(SpellCooldowns::const_iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end(); ++itr) { - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(itr->first); data << uint64(GetGUID()); GetSession()->SendPacket(&data); @@ -3426,7 +3426,7 @@ void Player::_SaveSpellCooldowns() m_spellCooldowns.erase(itr++); else if(itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload { - CharacterDatabase.PExecute("INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES ('%u', '%u', '%u', '" I64FMTD "')", GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end)); + CharacterDatabase.PExecute("INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES ('%u', '%u', '%u', '" UI64FMTD "')", GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end)); ++itr; } else @@ -8967,7 +8967,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV if(slot >= VANITYPET_SLOT_START && slot < VANITYPET_SLOT_END) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - // currencytoken case (disabled until proper implement) + // currencytoken case if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; @@ -9635,7 +9635,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } // check free space for all items - for (int k=0;k<count;k++) + for (int k = 0; k < count; ++k) { Item *pItem = pItems[k]; @@ -9666,7 +9666,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const { bool b_found = false; - for(int t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; t++) + for(int t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; ++t) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) @@ -9678,7 +9678,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; t++) + for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) @@ -9690,7 +9690,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; t++) + for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t ); if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize()) @@ -9702,7 +9702,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } if (b_found) continue; - for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; t++) + for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); if( pBag && ItemCanGoIntoBag(pItem->GetProto(), pBag->GetProto())) @@ -9757,7 +9757,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if (b_found) continue; - for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; t++) + for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); if( pBag ) @@ -9785,7 +9785,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const // search free slot bool b_found = false; - for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; t++) + for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) { if( inv_slot_items[t-INVENTORY_SLOT_ITEM_START] == 0 ) { @@ -9797,7 +9797,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if (b_found) continue; // search free slot in bags - for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; t++) + for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) { pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); if( pBag ) @@ -10106,14 +10106,14 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p } else { - res = _CanStoreItem_InBag(bag,dest,pProto,count,false,false,pItem,NULL_BAG,slot); - if(res!=EQUIP_ERR_OK) - res = _CanStoreItem_InBag(bag,dest,pProto,count,false,true,pItem,NULL_BAG,slot); + res = _CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot); + if(res != EQUIP_ERR_OK) + res = _CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot); - if(res!=EQUIP_ERR_OK) + if(res != EQUIP_ERR_OK) return res; - if(count==0) + if(count == 0) return EQUIP_ERR_OK; } } @@ -10125,10 +10125,10 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p { // in slots res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot); - if(res!=EQUIP_ERR_OK) + if(res != EQUIP_ERR_OK) return res; - if(count==0) + if(count == 0) return EQUIP_ERR_OK; // in special bags @@ -10398,7 +10398,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo if (!pItem2) { if (clone) - pItem = pItem->CloneItem(count,this); + pItem = pItem->CloneItem(count, this); else pItem->SetCount(count); @@ -10413,7 +10413,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo if (bag == INVENTORY_SLOT_BAG_0) { m_items[slot] = pItem; - SetUInt64Value( (uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2) ), pItem->GetGUID() ); + SetUInt64Value( PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID() ); pItem->SetUInt64Value( ITEM_FIELD_CONTAINED, GetGUID() ); pItem->SetUInt64Value( ITEM_FIELD_OWNER, GetGUID() ); @@ -10422,7 +10422,7 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo // need update known currency if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) - UpdateKnownCurrencies(pItem->GetEntry(),true); + UpdateKnownCurrencies(pItem->GetEntry(), true); if (IsInWorld() && update) { @@ -10517,7 +10517,7 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) // item set bonuses applied only at equip and removed at unequip, and still active for broken items if(pProto && pProto->ItemSet) - AddItemsSetItem(this,pItem); + AddItemsSetItem(this, pItem); _ApplyItemMods(pItem, slot, true); @@ -10606,20 +10606,13 @@ void Player::QuickEquipItem( uint16 pos, Item *pItem) pItem->AddToWorld(); pItem->SendUpdateToPlayer( this ); } + + GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); } } void Player::SetVisibleItemSlot(uint8 slot, Item *pItem) { - // PLAYER_VISIBLE_ITEM_i_CREATOR // Size: 2 - // PLAYER_VISIBLE_ITEM_i_0 // Size: 12 - // entry // Size: 1 - // inspected enchantments // Size: 6 - // ? // Size: 5 - // PLAYER_VISIBLE_ITEM_i_PROPERTIES // Size: 1 (property,suffix factor) - // PLAYER_VISIBLE_ITEM_i_PAD // Size: 1 - // // = 16 - if(pItem) { SetUInt64Value(PLAYER_VISIBLE_ITEM_1_CREATOR + (slot * MAX_VISIBLE_ITEM_OFFSET), pItem->GetUInt64Value(ITEM_FIELD_CREATOR)); @@ -10661,14 +10654,14 @@ void Player::VisualizeItem( uint8 slot, Item *pItem) sLog.outDebug( "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); m_items[slot] = pItem; - SetUInt64Value( (uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2) ), pItem->GetGUID() ); + SetUInt64Value( PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), pItem->GetGUID() ); pItem->SetUInt64Value( ITEM_FIELD_CONTAINED, GetGUID() ); pItem->SetUInt64Value( ITEM_FIELD_OWNER, GetGUID() ); pItem->SetSlot( slot ); pItem->SetContainer( NULL ); if( slot < EQUIPMENT_SLOT_END ) - SetVisibleItemSlot(slot,pItem); + SetVisibleItemSlot(slot, pItem); pItem->SetState(ITEM_CHANGED, this); } @@ -10696,7 +10689,7 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update ) // item set bonuses applied only at equip and removed at unequip, and still active for broken items if(pProto && pProto->ItemSet) - RemoveItemsSetItem(this,pProto); + RemoveItemsSetItem(this, pProto); _ApplyItemMods(pItem, slot, false); @@ -10727,13 +10720,13 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update ) } // need update known currency else if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) - UpdateKnownCurrencies(pItem->GetEntry(),false); + UpdateKnownCurrencies(pItem->GetEntry(), false); m_items[slot] = NULL; - SetUInt64Value((uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot*2)), 0); + SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); if ( slot < EQUIPMENT_SLOT_END ) - SetVisibleItemSlot(slot,NULL); + SetVisibleItemSlot(slot, NULL); } else { @@ -10754,8 +10747,8 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update) { if(Item* it = GetItemByPos(bag,slot)) { - ItemRemovedQuestCheck(it->GetEntry(),it->GetCount()); - RemoveItem( bag,slot,update); + ItemRemovedQuestCheck(it->GetEntry(), it->GetCount()); + RemoveItem(bag, slot, update); it->RemoveFromUpdateQueueOf(this); if(it->IsInWorld()) { @@ -10769,13 +10762,13 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update) void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool update, bool in_characterInventoryDB) { // update quest counters - ItemAddedQuestCheck(pItem->GetEntry(),pItem->GetCount()); + ItemAddedQuestCheck(pItem->GetEntry(), pItem->GetCount()); // store item - Item* pLastItem = StoreItem( dest, pItem, update); + Item* pLastItem = StoreItem(dest, pItem, update); // only set if not merged to existed stack (pItem can be deleted already but we can compare pointers any way) - if(pLastItem==pItem) + if(pLastItem == pItem) { // update owner for last item (this can be original item with wrong owner if(pLastItem->GetOwnerGUID() != GetGUID()) @@ -10797,8 +10790,8 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) // start from destroy contained items (only equipped bag can have its) if (pItem->IsBag() && pItem->IsEquipped()) // this also prevent infinity loop if empty bag stored in bag==slot { - for (int i = 0; i < MAX_BAG_SIZE; i++) - DestroyItem(slot,i,update); + for (int i = 0; i < MAX_BAG_SIZE; ++i) + DestroyItem(slot, i, update); } if(pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) @@ -10811,7 +10804,7 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) if( bag == INVENTORY_SLOT_BAG_0 ) { - SetUInt64Value((uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot*2)), 0); + SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); // equipment and equipped bags can have applied bonuses if ( slot < INVENTORY_SLOT_BAG_END ) @@ -10820,7 +10813,7 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) // item set bonuses applied only at equip and removed at unequip, and still active for broken items if(pProto && pProto->ItemSet) - RemoveItemsSetItem(this,pProto); + RemoveItemsSetItem(this, pProto); _ApplyItemMods(pItem, slot, false); } @@ -10837,11 +10830,11 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) UpdateExpertise(OFF_ATTACK); // equipment visual show - SetVisibleItemSlot(slot,NULL); + SetVisibleItemSlot(slot, NULL); } // need update known currency else if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) - UpdateKnownCurrencies(pItem->GetEntry(),false); + UpdateKnownCurrencies(pItem->GetEntry(), false); m_items[slot] = NULL; } @@ -10879,7 +10872,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq remcount += pItem->GetCount(); DestroyItem( INVENTORY_SLOT_BAG_0, i, update); - if (remcount >=count) + if (remcount >= count) return; } else @@ -10907,7 +10900,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq remcount += pItem->GetCount(); DestroyItem( INVENTORY_SLOT_BAG_0, i, update); - if (remcount >=count) + if (remcount >= count) return; } else @@ -10940,7 +10933,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq remcount += pItem->GetCount(); DestroyItem( i, j, update ); - if (remcount >=count) + if (remcount >= count) return; } else @@ -10967,12 +10960,12 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq { if (pItem->GetCount() + remcount <= count) { - if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i,false) == EQUIP_ERR_OK ) + if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK ) { remcount += pItem->GetCount(); DestroyItem( INVENTORY_SLOT_BAG_0, i, update); - if (remcount >=count) + if (remcount >= count) return; } } @@ -10997,12 +10990,12 @@ void Player::DestroyZoneLimitedItem( bool update, uint32 new_zone ) // in inventory for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) - if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) + if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) - if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) + if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); // in inventory bags @@ -11010,13 +11003,13 @@ void Player::DestroyZoneLimitedItem( bool update, uint32 new_zone ) if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) for(uint32 j = 0; j < pBag->GetBagSize(); j++) if (Item* pItem = pBag->GetItemByPos(j)) - if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) - DestroyItem( i, j, update); + if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) + DestroyItem(i, j, update); // in equipment and bag list for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) - if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) + if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); } @@ -11056,7 +11049,7 @@ void Player::DestroyItemCount( Item* pItem, uint32 &count, bool update ) if( pItem->GetCount() <= count ) { - count-= pItem->GetCount(); + count -= pItem->GetCount(); DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), update); } @@ -11295,7 +11288,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) } RemoveItem(srcbag, srcslot, true); - EquipItem( dest, pSrcItem, true); + EquipItem(dest, pSrcItem, true); AutoUnequipOffhandIfNeed(); } @@ -11425,7 +11418,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) ItemPrototype const* bagItemProto = bagItem->GetProto(); if (!bagItemProto || !ItemCanGoIntoBag(bagItemProto, emotyProto)) { - // one from items not go to empry target bag + // one from items not go to empty target bag SendEquipError( EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG, pSrcItem, pDstItem ); return; } @@ -11443,7 +11436,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) // Items swap count = 0; // will pos in new bag - for(int i=0; i< fullBag->GetBagSize(); ++i) + for(int i = 0; i< fullBag->GetBagSize(); ++i) { Item *bagItem = fullBag->GetItemByPos(i); if (!bagItem) @@ -11522,7 +11515,7 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) uint32 etime = uint32(base - m_logintime + (30 * 3600)); uint32 eslot = slot - BUYBACK_SLOT_START; - SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + eslot * 2, pItem->GetGUID() ); + SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID() ); ItemPrototype const *pProto = pItem->GetProto(); if( pProto ) SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount() ); @@ -11531,7 +11524,7 @@ void Player::AddItemToBuyBackSlot( Item *pItem ) SetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, (uint32)etime ); // move to next (for non filled list is move most optimized choice) - if(m_currentBuybackSlot < BUYBACK_SLOT_END-1) + if(m_currentBuybackSlot < BUYBACK_SLOT_END - 1) ++m_currentBuybackSlot; } } @@ -11559,7 +11552,7 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del ) m_items[slot] = NULL; uint32 eslot = slot - BUYBACK_SLOT_START; - SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + eslot * 2, 0 ); + SetUInt64Value( PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0 ); SetUInt32Value( PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0 ); SetUInt32Value( PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0 ); @@ -11571,7 +11564,7 @@ void Player::RemoveItemFromBuyBackSlot( uint32 slot, bool del ) void Player::SendEquipError( uint8 msg, Item* pItem, Item *pItem2 ) { - sLog.outDebug( "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)",msg); + sLog.outDebug( "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); WorldPacket data( SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18) ); data << uint8(msg); @@ -11654,9 +11647,9 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) if(m_itemDuration.empty()) return; - sLog.outDebug("Player::UpdateItemDuration(%u,%u)", time,realtimeonly); + sLog.outDebug("Player::UpdateItemDuration(%u,%u)", time, realtimeonly); - for(ItemDurationList::iterator itr = m_itemDuration.begin();itr != m_itemDuration.end(); ) + for(ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ) { Item* item = *itr; ++itr; // current element can be erased in UpdateDuration @@ -11671,14 +11664,14 @@ void Player::UpdateEnchantTime(uint32 time) for(EnchantDurationList::iterator itr = m_enchantDuration.begin(),next;itr != m_enchantDuration.end();itr=next) { assert(itr->item); - next=itr; + next = itr; if(!itr->item->GetEnchantmentId(itr->slot)) { next = m_enchantDuration.erase(itr); } else if(itr->leftduration <= time) { - ApplyEnchantment(itr->item,itr->slot,false,false); + ApplyEnchantment(itr->item, itr->slot, false, false); itr->item->ClearEnchantment(itr->slot); next = m_enchantDuration.erase(itr); } @@ -11692,25 +11685,25 @@ void Player::UpdateEnchantTime(uint32 time) void Player::AddEnchantmentDurations(Item *item) { - for(int x=0;x<MAX_ENCHANTMENT_SLOT;++x) + for(int x = 0; x < MAX_ENCHANTMENT_SLOT; ++x) { if(!item->GetEnchantmentId(EnchantmentSlot(x))) continue; uint32 duration = item->GetEnchantmentDuration(EnchantmentSlot(x)); if( duration > 0 ) - AddEnchantmentDuration(item,EnchantmentSlot(x),duration); + AddEnchantmentDuration(item, EnchantmentSlot(x), duration); } } void Player::RemoveEnchantmentDurations(Item *item) { - for(EnchantDurationList::iterator itr = m_enchantDuration.begin();itr != m_enchantDuration.end();) + for(EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end();) { if(itr->item == item) { // save duration in item - item->SetEnchantmentDuration(EnchantmentSlot(itr->slot),itr->leftduration); + item->SetEnchantmentDuration(EnchantmentSlot(itr->slot), itr->leftduration); itr = m_enchantDuration.erase(itr); } else @@ -11721,10 +11714,10 @@ void Player::RemoveEnchantmentDurations(Item *item) void Player::RemoveArenaEnchantments(EnchantmentSlot slot) { // remove enchantments from equipped items first to clean up the m_enchantDuration list - for(EnchantDurationList::iterator itr = m_enchantDuration.begin(),next;itr != m_enchantDuration.end();itr=next) + for(EnchantDurationList::iterator itr = m_enchantDuration.begin(), next; itr != m_enchantDuration.end(); itr = next) { next = itr; - if(itr->slot==slot) + if(itr->slot == slot) { if(itr->item && itr->item->GetEnchantmentId(slot)) { @@ -11735,7 +11728,7 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot) continue; } // remove from stats - ApplyEnchantment(itr->item,slot,false,false); + ApplyEnchantment(itr->item, slot, false, false); // remove visual itr->item->ClearEnchantment(slot); } @@ -11781,19 +11774,19 @@ void Player::AddEnchantmentDuration(Item *item,EnchantmentSlot slot,uint32 durat if(slot >= MAX_ENCHANTMENT_SLOT) return; - for(EnchantDurationList::iterator itr = m_enchantDuration.begin();itr != m_enchantDuration.end();++itr) + for(EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr) { if(itr->item == item && itr->slot == slot) { - itr->item->SetEnchantmentDuration(itr->slot,itr->leftduration); + itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration); m_enchantDuration.erase(itr); break; } } if(item && duration > 0 ) { - GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(),slot,uint32(duration/1000)); - m_enchantDuration.push_back(EnchantDuration(item,slot,duration)); + GetSession()->SendItemEnchantTimeUpdate(GetGUID(), item->GetGUID(), slot, uint32(duration/1000)); + m_enchantDuration.push_back(EnchantDuration(item, slot, duration)); } } @@ -11803,7 +11796,7 @@ void Player::ApplyEnchantment(Item *item,bool apply) ApplyEnchantment(item, EnchantmentSlot(slot), apply); } -void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool apply_dur, bool ignore_condition) +void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition) { if(!item) return; @@ -11827,7 +11820,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a if (!item->IsBroken()) { - for (int s=0; s<3; s++) + for (int s = 0; s < 3; ++s) { uint32 enchant_display_type = pEnchant->type[s]; uint32 enchant_amount = pEnchant->amount[s]; @@ -11861,11 +11854,11 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a if (item_rand) { // Search enchant_amount - for (int k=0; k<3; k++) + for (int k = 0; k < 3; ++k) { if(item_rand->enchant_id[k] == enchant_id) { - basepoints = int32((item_rand->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); + basepoints = int32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000 ); break; } } @@ -11873,12 +11866,12 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a } // Cast custom spell vs all equal basepoints getted from enchant_amount if (basepoints) - CastCustomSpell(this,enchant_spell_id,&basepoints,&basepoints,&basepoints,true,item); + CastCustomSpell(this, enchant_spell_id, &basepoints, &basepoints, &basepoints, true, item); else - CastSpell(this,enchant_spell_id,true,item); + CastSpell(this, enchant_spell_id, true, item); } else - RemoveAurasDueToItemSpell(item,enchant_spell_id); + RemoveAurasDueToItemSpell(item, enchant_spell_id); } break; case ITEM_ENCHANTMENT_TYPE_RESISTANCE: @@ -11887,11 +11880,11 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if(item_rand) { - for (int k=0; k<3; k++) + for (int k = 0; k < 3; ++k) { if(item_rand->enchant_id[k] == enchant_id) { - enchant_amount = uint32((item_rand->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); + enchant_amount = uint32((item_rand->prefix[k] * item->GetItemSuffixFactor()) / 10000 ); break; } } @@ -11907,11 +11900,11 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if(item_rand_suffix) { - for (int k=0; k<3; k++) + for (int k = 0; k < 3; ++k) { if(item_rand_suffix->enchant_id[k] == enchant_id) { - enchant_amount = uint32((item_rand_suffix->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); + enchant_amount = uint32((item_rand_suffix->prefix[k] * item->GetItemSuffixFactor()) / 10000 ); break; } } @@ -12108,12 +12101,12 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a float addValue = 0.0f; if(item->GetSlot() == EQUIPMENT_SLOT_MAINHAND) { - addValue = float(enchant_amount * item->GetProto()->Delay/1000.0f); + addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f); HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, addValue, apply); } else if(item->GetSlot() == EQUIPMENT_SLOT_OFFHAND ) { - addValue = float(enchant_amount * item->GetProto()->Delay/1000.0f); + addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f); HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, addValue, apply); } } @@ -12146,27 +12139,27 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a // set duration uint32 duration = item->GetEnchantmentDuration(slot); if(duration > 0) - AddEnchantmentDuration(item,slot,duration); + AddEnchantmentDuration(item, slot, duration); } else { // duration == 0 will remove EnchantDuration - AddEnchantmentDuration(item,slot,0); + AddEnchantmentDuration(item, slot, 0); } } } void Player::SendEnchantmentDurations() { - for(EnchantDurationList::iterator itr = m_enchantDuration.begin();itr != m_enchantDuration.end();++itr) + for(EnchantDurationList::const_iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr) { - GetSession()->SendItemEnchantTimeUpdate(GetGUID(), itr->item->GetGUID(),itr->slot,uint32(itr->leftduration)/1000); + GetSession()->SendItemEnchantTimeUpdate(GetGUID(), itr->item->GetGUID(), itr->slot, uint32(itr->leftduration) / 1000); } } void Player::SendItemDurations() { - for(ItemDurationList::iterator itr = m_itemDuration.begin();itr != m_itemDuration.end();++itr) + for(ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr) { (*itr)->SendTimeUpdate(this); } @@ -12179,18 +12172,18 @@ void Player::SendNewItem(Item *item, uint32 count, bool received, bool created, // last check 2.0.10 WorldPacket data( SMSG_ITEM_PUSH_RESULT, (8+4+4+4+1+4+4+4+4+4) ); - data << GetGUID(); // player GUID + data << uint64(GetGUID()); // player GUID data << uint32(received); // 0=looted, 1=from npc data << uint32(created); // 0=received, 1=created data << uint32(1); // always 0x01 (probably meant to be count of listed items) - data << (uint8)item->GetBagSlot(); // bagslot + data << uint8(item->GetBagSlot()); // bagslot // item slot, but when added to stack: 0xFFFFFFFF - data << (uint32) ((item->GetCount()==count) ? item->GetSlot() : -1); + data << uint32((item->GetCount() == count) ? item->GetSlot() : -1); data << uint32(item->GetEntry()); // item id data << uint32(item->GetItemSuffixFactor()); // SuffixFactor data << uint32(item->GetItemRandomPropertyId()); // random item property id data << uint32(count); // count of items - data << GetItemCount(item->GetEntry()); // count of items in inventory + data << uint32(GetItemCount(item->GetEntry())); // count of items in inventory if (broadcast && GetGroup()) GetGroup()->BroadcastPacket(&data, true); @@ -12209,7 +12202,7 @@ void Player::PrepareQuestMenu( uint64 guid ) QuestRelations* pObjectQIR; // pets also can have quests - Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid); + Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); if( pCreature ) { pObject = (Object*)pCreature; @@ -12275,10 +12268,11 @@ void Player::SendPreparedQuest( uint64 guid ) // Auto open -- maybe also should verify there is no greeting uint32 quest_id = qmi0.m_qId; Quest const* pQuest = objmgr.GetQuestTemplate(quest_id); + if ( pQuest ) { if( status == DIALOG_STATUS_REWARD_REP && !GetQuestRewardStatus( quest_id ) ) - PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanRewardQuest(pQuest,false), true ); + PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, CanRewardQuest(pQuest, false), true ); else if( status == DIALOG_STATUS_INCOMPLETE ) PlayerTalkClass->SendQuestGiverRequestItems( pQuest, guid, false, true ); // Send completable on repeatable quest if player don't have quest @@ -14219,7 +14213,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if(!LoadValues( fields[2].GetString())) { - sLog.outError("Player #%d have broken data in `data` field. Can't be loaded.",GUID_LOPART(guid)); + sLog.outError("Player #%d have broken data in `data` field. Can't be loaded.", GUID_LOPART(guid)); delete result; return false; } @@ -14230,8 +14224,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // cleanup inventory related item value fields (its will be filled correctly in _LoadInventory) for(uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot) { - SetUInt64Value( (uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2) ), 0 ); - SetVisibleItemSlot(slot,NULL); + SetUInt64Value( PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0 ); + SetVisibleItemSlot(slot, NULL); if (m_items[slot]) { @@ -14645,7 +14639,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if(uint32 curTitle = GetUInt32Value(PLAYER_CHOSEN_TITLE)) { if(!HasTitle(curTitle)) - SetUInt32Value(PLAYER_CHOSEN_TITLE,0); + SetUInt32Value(PLAYER_CHOSEN_TITLE, 0); } // Not finish taxi flight path @@ -15135,7 +15129,7 @@ void Player::_LoadMailedItems(Mail *mail) void Player::_LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery) { //set a count of unread mails - //QueryResult *resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" I64FMTD "'", GUID_LOPART(playerGuid),(uint64)cTime); + //QueryResult *resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid),(uint64)cTime); if (resultUnread) { Field *fieldMail = resultUnread->Fetch(); @@ -15271,18 +15265,18 @@ void Player::_LoadQuestStatus(QueryResult *result) // add to quest log if( slot < MAX_QUEST_LOG_SIZE && - ( questStatusData.m_status==QUEST_STATUS_INCOMPLETE || - questStatusData.m_status==QUEST_STATUS_COMPLETE && + ( questStatusData.m_status == QUEST_STATUS_INCOMPLETE || + questStatusData.m_status == QUEST_STATUS_COMPLETE && (!questStatusData.m_rewarded || pQuest->IsDaily()) ) ) { - SetQuestSlot(slot,quest_id,quest_time); + SetQuestSlot(slot, quest_id, quest_time); if(questStatusData.m_status == QUEST_STATUS_COMPLETE) - SetQuestSlotState(slot,QUEST_STATE_COMPLETE); + SetQuestSlotState(slot, QUEST_STATE_COMPLETE); for(uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx) if(questStatusData.m_creatureOrGOcount[idx]) - SetQuestSlotCounter(slot,idx,questStatusData.m_creatureOrGOcount[idx]); + SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]); ++slot; } @@ -15300,7 +15294,7 @@ void Player::_LoadQuestStatus(QueryResult *result) } if(pQuest->GetBonusTalents()) - m_questRewardTalentCount+=pQuest->GetBonusTalents(); + m_questRewardTalentCount += pQuest->GetBonusTalents(); } sLog.outDebug("Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.m_status, quest_id, GetGUIDLow()); @@ -15313,7 +15307,7 @@ void Player::_LoadQuestStatus(QueryResult *result) // clear quest log tail for ( uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i ) - SetQuestSlot(i,0); + SetQuestSlot(i, 0); } void Player::_LoadDailyQuestStatus(QueryResult *result) @@ -15548,7 +15542,7 @@ void Player::SendRaidInfo() } } } - data.put<uint32>(p_counter,counter); + data.put<uint32>(p_counter, counter); GetSession()->SendPacket(&data); } @@ -15995,7 +15989,7 @@ void Player::_SaveAuras() } CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2,maxduration,remaintime,remaincharges) " - "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + "VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", GetGUIDLow(), itr->second->GetCasterGUID(),(uint32)itr->second->GetId(), (uint32)itr->second->GetEffectMask(), (int32)itr->second->GetStackAmount(), (int32)amounts[0], (int32)amounts[1], (int32)amounts[2] ,int(itr->second->GetAuraMaxDuration()),int(itr->second->GetAuraDuration()),int(itr->second->GetAuraCharges())); @@ -16089,7 +16083,7 @@ void Player::_SaveMail() Mail *m = (*itr); if (m->state == MAIL_STATE_CHANGED) { - CharacterDatabase.PExecute("UPDATE mail SET itemTextId = '%u',has_items = '%u',expire_time = '" I64FMTD "', deliver_time = '" I64FMTD "',money = '%u',cod = '%u',checked = '%u' WHERE id = '%u'", + CharacterDatabase.PExecute("UPDATE mail SET itemTextId = '%u',has_items = '%u',expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',money = '%u',cod = '%u',checked = '%u' WHERE id = '%u'", m->itemTextId, m->HasItems() ? 1 : 0, (uint64)m->expire_time, (uint64)m->deliver_time, m->money, m->COD, m->checked, m->messageID); if(m->removedItems.size()) { @@ -16137,11 +16131,11 @@ void Player::_SaveQuestStatus() { case QUEST_NEW : CharacterDatabase.PExecute("INSERT INTO character_queststatus (guid,quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4) " - "VALUES ('%u', '%u', '%u', '%u', '%u', '" I64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", + "VALUES ('%u', '%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", GetGUIDLow(), i->first, i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS+ sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3]); break; case QUEST_CHANGED : - CharacterDatabase.PExecute("UPDATE character_queststatus SET status = '%u',rewarded = '%u',explored = '%u',timer = '" I64FMTD "',mobcount1 = '%u',mobcount2 = '%u',mobcount3 = '%u',mobcount4 = '%u',itemcount1 = '%u',itemcount2 = '%u',itemcount3 = '%u',itemcount4 = '%u' WHERE guid = '%u' AND quest = '%u' ", + CharacterDatabase.PExecute("UPDATE character_queststatus SET status = '%u',rewarded = '%u',explored = '%u',timer = '" UI64FMTD "',mobcount1 = '%u',mobcount2 = '%u',mobcount3 = '%u',mobcount4 = '%u',itemcount1 = '%u',itemcount2 = '%u',itemcount3 = '%u',itemcount4 = '%u' WHERE guid = '%u' AND quest = '%u' ", i->second.m_status, i->second.m_rewarded, i->second.m_explored, uint64(i->second.m_timer / IN_MILISECONDS + sWorld.GetGameTime()), i->second.m_creatureOrGOcount[0], i->second.m_creatureOrGOcount[1], i->second.m_creatureOrGOcount[2], i->second.m_creatureOrGOcount[3], i->second.m_itemcount[0], i->second.m_itemcount[1], i->second.m_itemcount[2], i->second.m_itemcount[3], GetGUIDLow(), i->first ); break; case QUEST_UNCHANGED: @@ -16164,7 +16158,7 @@ void Player::_SaveDailyQuestStatus() CharacterDatabase.PExecute("DELETE FROM character_queststatus_daily WHERE guid = '%u'",GetGUIDLow()); for(uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) if(GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)) - CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest,time) VALUES ('%u', '%u','" I64FMTD "')", + CharacterDatabase.PExecute("INSERT INTO character_queststatus_daily (guid,quest,time) VALUES ('%u', '%u','" UI64FMTD "')", GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx),uint64(m_lastDailyQuestTime)); } @@ -16791,7 +16785,7 @@ void Player::PetSpellInitialize() CharmInfo *charmInfo = pet->GetCharmInfo(); - WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+10*4); + WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1); data << uint64(pet->GetGUID()); data << uint32(pet->GetCreatureInfo()->family); // creature family (required for pet talents) data << uint32(0); @@ -16862,26 +16856,20 @@ void Player::PossessSpellInitialize() if(!charmInfo) { - sLog.outError("Player::PossessSpellInitialize(): charm ("I64FMTD") has no charminfo!", charm->GetGUID()); + sLog.outError("Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID()); return; } - WorldPacket data(SMSG_PET_SPELLS, 20+40+1+1); - - //basic info 20 + WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1); data << uint64(charm->GetGUID()); - data << uint32(0x00000000); + data << uint32(0); data << uint32(0); data << uint32(0); - //action bar 40 - charmInfo->BuildActionBar(&data); //40 - - //addlist 1 - data << uint8(0); + charmInfo->BuildActionBar(&data); - //cooldown 1 - data << uint8(0); + data << uint8(0); // spells count + data << uint8(0); // cooldowns count GetSession()->SendPacket(&data); } @@ -16934,7 +16922,7 @@ void Player::CharmSpellInitialize() CharmInfo *charmInfo = charm->GetCharmInfo(); if(!charmInfo) { - sLog.outError("Player::CharmSpellInitialize(): the player's charm ("I64FMTD") has no charminfo!", charm->GetGUID()); + sLog.outError("Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID()); return; } @@ -16952,23 +16940,20 @@ void Player::CharmSpellInitialize() } } - WorldPacket data(SMSG_PET_SPELLS, 20+40+1+4*addlist+1);// first line + actionbar + spellcount + spells + last adds - - //basic info 20 + WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+4*addlist+1); data << uint64(charm->GetGUID()); data << uint32(0); data << uint32(0); + if(charm->GetTypeId() != TYPEID_PLAYER) data << uint8(((Creature*)charm)->GetReactState()) << uint8(charmInfo->GetCommandState()); else - data << uint8(0) << uint8(0); - data << uint16(0); + data << uint8(0) << uint8(0) << uint16(0); + + charmInfo->BuildActionBar(&data); - //action bar 40 - charmInfo->BuildActionBar(&data); //40 + data << uint8(addlist); - //add list - data << uint8(addlist); //1 if(addlist) { for(uint32 i = 0; i < MAX_SPELL_CHARM; ++i) @@ -16982,9 +16967,7 @@ void Player::CharmSpellInitialize() } } - //cooldown - uint8 count = 0; - data << uint8(count); // cooldowns count + data << uint8(0); // cooldowns count GetSession()->SendPacket(&data); } @@ -17436,8 +17419,8 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) if((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs ) { - data << unSpellId; - data << unTimeMs; // in m.secs + data << uint32(unSpellId); + data << uint32(unTimeMs); // in m.secs AddSpellCooldown(unSpellId, 0, curTime + unTimeMs/IN_MILISECONDS); } } @@ -18408,7 +18391,7 @@ void Player::SendInitialVisiblePackets(Unit* target) if(target->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) target->SendMonsterMoveWithSpeedToCurrentDestination(this); if(target->hasUnitState(UNIT_STAT_MELEE_ATTACKING) && target->getVictim()) - target->SendAttackStart(target->getVictim()); + target->SendMeleeAttackStart(target->getVictim()); } } @@ -19516,8 +19499,9 @@ uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const void Player::ResurectUsingRequestData() { - /// Teleport before resurrecting, otherwise the player might get attacked from creatures near his corpse - TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation()); + /// Teleport before resurrecting by player, otherwise the player might get attacked from creatures near his corpse + if(IS_PLAYER_GUID(m_resurrectGUID)) + TeleportTo(m_resurrectMap, m_resurrectX, m_resurrectY, m_resurrectZ, GetOrientation()); ResurrectPlayer(0.0f,false); @@ -19982,16 +19966,16 @@ bool Player::HasTitle(uint32 bitIndex) if (bitIndex > 128) return false; - uint32 fieldIndexOffset = bitIndex/32; - uint32 flag = 1 << (bitIndex%32); - return HasFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag); + uint32 fieldIndexOffset = bitIndex / 32; + uint32 flag = 1 << (bitIndex % 32); + return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); } void Player::SetTitle(CharTitlesEntry const* title) { - uint32 fieldIndexOffset = title->bit_index/32; - uint32 flag = 1 << (title->bit_index%32); - SetFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag); + uint32 fieldIndexOffset = title->bit_index / 32; + uint32 flag = 1 << (title->bit_index % 32); + SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); } /*-----------------------TRINITY--------------------------*/ diff --git a/src/game/Player.h b/src/game/Player.h index 33693842154..6cf949453d3 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -148,6 +148,7 @@ struct ActionButton enum ActionButtonType { ACTION_BUTTON_SPELL = 0, + ACTION_BUTTON_EQSET = 32, ACTION_BUTTON_MACRO = 64, ACTION_BUTTON_CMACRO= 65, ACTION_BUTTON_ITEM = 128 @@ -289,14 +290,32 @@ struct EnchantDuration typedef std::list<EnchantDuration> EnchantDurationList; typedef std::list<Item*> ItemDurationList; +enum LfgType +{ + LFG_TYPE_NONE = 0, + LFG_TYPE_DUNGEON = 1, + LFG_TYPE_RAID = 2, + LFG_TYPE_QUEST = 3, + LFG_TYPE_ZONE = 4, + LFG_TYPE_HEROIC_DUNGEON = 5 +}; + +enum LfgRoles +{ + LEADER = 1, + TANK = 2, + HEALER = 4, + DAMAGE = 8 +}; + struct LookingForGroupSlot { LookingForGroupSlot() : entry(0), type(0) {} bool Empty() const { return !entry && !type; } void Clear() { entry = 0; type = 0; } void Set(uint32 _entry, uint32 _type ) { entry = _entry; type = _type; } - bool Is(uint32 _entry, uint32 _type) const { return entry==_entry && type==_type; } - bool canAutoJoin() const { return entry && (type == 1 || type == 5); } + bool Is(uint32 _entry, uint32 _type) const { return entry == _entry && type == _type; } + bool canAutoJoin() const { return entry && (type == LFG_TYPE_DUNGEON || type == LFG_TYPE_HEROIC_DUNGEON); } uint32 entry; uint32 type; @@ -307,11 +326,11 @@ struct LookingForGroupSlot struct LookingForGroup { LookingForGroup() {} - bool HaveInSlot(LookingForGroupSlot const& slot) const { return HaveInSlot(slot.entry,slot.type); } + bool HaveInSlot(LookingForGroupSlot const& slot) const { return HaveInSlot(slot.entry, slot.type); } bool HaveInSlot(uint32 _entry, uint32 _type) const { for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i) - if(slots[i].Is(_entry,_type)) + if(slots[i].Is(_entry, _type)) return true; return false; } @@ -384,48 +403,48 @@ enum PlayerFlags // used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1) // can't use enum for uint64 values -#define PLAYER_TITLE_DISABLED 0x0000000000000000LL -#define PLAYER_TITLE_NONE 0x0000000000000001LL -#define PLAYER_TITLE_PRIVATE 0x0000000000000002LL // 1 -#define PLAYER_TITLE_CORPORAL 0x0000000000000004LL // 2 -#define PLAYER_TITLE_SERGEANT_A 0x0000000000000008LL // 3 -#define PLAYER_TITLE_MASTER_SERGEANT 0x0000000000000010LL // 4 -#define PLAYER_TITLE_SERGEANT_MAJOR 0x0000000000000020LL // 5 -#define PLAYER_TITLE_KNIGHT 0x0000000000000040LL // 6 -#define PLAYER_TITLE_KNIGHT_LIEUTENANT 0x0000000000000080LL // 7 -#define PLAYER_TITLE_KNIGHT_CAPTAIN 0x0000000000000100LL // 8 -#define PLAYER_TITLE_KNIGHT_CHAMPION 0x0000000000000200LL // 9 -#define PLAYER_TITLE_LIEUTENANT_COMMANDER 0x0000000000000400LL // 10 -#define PLAYER_TITLE_COMMANDER 0x0000000000000800LL // 11 -#define PLAYER_TITLE_MARSHAL 0x0000000000001000LL // 12 -#define PLAYER_TITLE_FIELD_MARSHAL 0x0000000000002000LL // 13 -#define PLAYER_TITLE_GRAND_MARSHAL 0x0000000000004000LL // 14 -#define PLAYER_TITLE_SCOUT 0x0000000000008000LL // 15 -#define PLAYER_TITLE_GRUNT 0x0000000000010000LL // 16 -#define PLAYER_TITLE_SERGEANT_H 0x0000000000020000LL // 17 -#define PLAYER_TITLE_SENIOR_SERGEANT 0x0000000000040000LL // 18 -#define PLAYER_TITLE_FIRST_SERGEANT 0x0000000000080000LL // 19 -#define PLAYER_TITLE_STONE_GUARD 0x0000000000100000LL // 20 -#define PLAYER_TITLE_BLOOD_GUARD 0x0000000000200000LL // 21 -#define PLAYER_TITLE_LEGIONNAIRE 0x0000000000400000LL // 22 -#define PLAYER_TITLE_CENTURION 0x0000000000800000LL // 23 -#define PLAYER_TITLE_CHAMPION 0x0000000001000000LL // 24 -#define PLAYER_TITLE_LIEUTENANT_GENERAL 0x0000000002000000LL // 25 -#define PLAYER_TITLE_GENERAL 0x0000000004000000LL // 26 -#define PLAYER_TITLE_WARLORD 0x0000000008000000LL // 27 -#define PLAYER_TITLE_HIGH_WARLORD 0x0000000010000000LL // 28 -#define PLAYER_TITLE_GLADIATOR 0x0000000020000000LL // 29 -#define PLAYER_TITLE_DUELIST 0x0000000040000000LL // 30 -#define PLAYER_TITLE_RIVAL 0x0000000080000000LL // 31 -#define PLAYER_TITLE_CHALLENGER 0x0000000100000000LL // 32 -#define PLAYER_TITLE_SCARAB_LORD 0x0000000200000000LL // 33 -#define PLAYER_TITLE_CONQUEROR 0x0000000400000000LL // 34 -#define PLAYER_TITLE_JUSTICAR 0x0000000800000000LL // 35 -#define PLAYER_TITLE_CHAMPION_OF_THE_NAARU 0x0000001000000000LL // 36 -#define PLAYER_TITLE_MERCILESS_GLADIATOR 0x0000002000000000LL // 37 -#define PLAYER_TITLE_OF_THE_SHATTERED_SUN 0x0000004000000000LL // 38 -#define PLAYER_TITLE_HAND_OF_ADAL 0x0000008000000000LL // 39 -#define PLAYER_TITLE_VENGEFUL_GLADIATOR 0x0000010000000000LL // 40 +#define PLAYER_TITLE_DISABLED UI64LIT(0x0000000000000000) +#define PLAYER_TITLE_NONE UI64LIT(0x0000000000000001) +#define PLAYER_TITLE_PRIVATE UI64LIT(0x0000000000000002) // 1 +#define PLAYER_TITLE_CORPORAL UI64LIT(0x0000000000000004) // 2 +#define PLAYER_TITLE_SERGEANT_A UI64LIT(0x0000000000000008) // 3 +#define PLAYER_TITLE_MASTER_SERGEANT UI64LIT(0x0000000000000010) // 4 +#define PLAYER_TITLE_SERGEANT_MAJOR UI64LIT(0x0000000000000020) // 5 +#define PLAYER_TITLE_KNIGHT UI64LIT(0x0000000000000040) // 6 +#define PLAYER_TITLE_KNIGHT_LIEUTENANT UI64LIT(0x0000000000000080) // 7 +#define PLAYER_TITLE_KNIGHT_CAPTAIN UI64LIT(0x0000000000000100) // 8 +#define PLAYER_TITLE_KNIGHT_CHAMPION UI64LIT(0x0000000000000200) // 9 +#define PLAYER_TITLE_LIEUTENANT_COMMANDER UI64LIT(0x0000000000000400) // 10 +#define PLAYER_TITLE_COMMANDER UI64LIT(0x0000000000000800) // 11 +#define PLAYER_TITLE_MARSHAL UI64LIT(0x0000000000001000) // 12 +#define PLAYER_TITLE_FIELD_MARSHAL UI64LIT(0x0000000000002000) // 13 +#define PLAYER_TITLE_GRAND_MARSHAL UI64LIT(0x0000000000004000) // 14 +#define PLAYER_TITLE_SCOUT UI64LIT(0x0000000000008000) // 15 +#define PLAYER_TITLE_GRUNT UI64LIT(0x0000000000010000) // 16 +#define PLAYER_TITLE_SERGEANT_H UI64LIT(0x0000000000020000) // 17 +#define PLAYER_TITLE_SENIOR_SERGEANT UI64LIT(0x0000000000040000) // 18 +#define PLAYER_TITLE_FIRST_SERGEANT UI64LIT(0x0000000000080000) // 19 +#define PLAYER_TITLE_STONE_GUARD UI64LIT(0x0000000000100000) // 20 +#define PLAYER_TITLE_BLOOD_GUARD UI64LIT(0x0000000000200000) // 21 +#define PLAYER_TITLE_LEGIONNAIRE UI64LIT(0x0000000000400000) // 22 +#define PLAYER_TITLE_CENTURION UI64LIT(0x0000000000800000) // 23 +#define PLAYER_TITLE_CHAMPION UI64LIT(0x0000000001000000) // 24 +#define PLAYER_TITLE_LIEUTENANT_GENERAL UI64LIT(0x0000000002000000) // 25 +#define PLAYER_TITLE_GENERAL UI64LIT(0x0000000004000000) // 26 +#define PLAYER_TITLE_WARLORD UI64LIT(0x0000000008000000) // 27 +#define PLAYER_TITLE_HIGH_WARLORD UI64LIT(0x0000000010000000) // 28 +#define PLAYER_TITLE_GLADIATOR UI64LIT(0x0000000020000000) // 29 +#define PLAYER_TITLE_DUELIST UI64LIT(0x0000000040000000) // 30 +#define PLAYER_TITLE_RIVAL UI64LIT(0x0000000080000000) // 31 +#define PLAYER_TITLE_CHALLENGER UI64LIT(0x0000000100000000) // 32 +#define PLAYER_TITLE_SCARAB_LORD UI64LIT(0x0000000200000000) // 33 +#define PLAYER_TITLE_CONQUEROR UI64LIT(0x0000000400000000) // 34 +#define PLAYER_TITLE_JUSTICAR UI64LIT(0x0000000800000000) // 35 +#define PLAYER_TITLE_CHAMPION_OF_THE_NAARU UI64LIT(0x0000001000000000) // 36 +#define PLAYER_TITLE_MERCILESS_GLADIATOR UI64LIT(0x0000002000000000) // 37 +#define PLAYER_TITLE_OF_THE_SHATTERED_SUN UI64LIT(0x0000004000000000) // 38 +#define PLAYER_TITLE_HAND_OF_ADAL UI64LIT(0x0000008000000000) // 39 +#define PLAYER_TITLE_VENGEFUL_GLADIATOR UI64LIT(0x0000010000000000) // 40 // used in PLAYER_FIELD_BYTES values enum PlayerFieldByteFlags @@ -1363,7 +1382,7 @@ class TRINITY_DLL_SPEC Player : public Unit uint32 GetGlyph(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_GLYPHS_1 + slot); } uint32 GetFreePrimaryProffesionPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS2); } - void SetFreePrimaryProffesions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2,profs); } + void SetFreePrimaryProffesions(uint16 profs) { SetUInt32Value(PLAYER_CHARACTER_POINTS2, profs); } void InitPrimaryProffesions(); PlayerSpellMap const& GetSpellMap() const { return m_spells; } diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index bdb02913f59..e5782fcb8df 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -181,10 +181,10 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty data << SubName; data << ci->IconName; // "Directions" for guard, string for Icons 2.3.0 - data << uint32(ci->type_flags); // flags wdbFeild7=wad flags1 - data << uint32(ci->type); - data << uint32(ci->family); // family wdbFeild9 - data << uint32(ci->rank); // rank wdbFeild10 + data << uint32(ci->type_flags); // flags + data << uint32(ci->type); // CreatureType.dbc + data << uint32(ci->family); // CreatureFamily.dbc + data << uint32(ci->rank); // Creature Rank (elite, boss, etc) data << uint32(ci->PetSpellDataId); // Id from CreatureSpellData.dbc wdbField12 data << (uint32)ci->Modelid_A1; // Modelid_A1 data << (uint32)ci->Modelid_A2; // Modelid_A2 @@ -193,7 +193,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) data << float(ci->unk17); // unk data << uint8(ci->RacialLeader); SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); + sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" ); } else { @@ -205,7 +205,7 @@ void WorldSession::HandleCreatureQueryOpcode( WorldPacket & recv_data ) WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4 ); data << uint32(entry | 0x80000000); SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE " ); + sLog.outDebug( "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE" ); } } @@ -220,7 +220,6 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) const GameObjectInfo *info = objmgr.GetGameObjectInfo(entryID); if(info) { - std::string Name; std::string IconName; std::string CastBarCaption; @@ -254,7 +253,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) data.append(info->raw.data, 24); data << float(info->size); // go size SendPacket( &data ); - sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " ); + sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" ); } else { @@ -267,7 +266,7 @@ void WorldSession::HandleGameObjectQueryOpcode( WorldPacket & recv_data ) WorldPacket data ( SMSG_GAMEOBJECT_QUERY_RESPONSE, 4 ); data << uint32(entryID | 0x80000000); SendPacket( &data ); - sLog.outDebug( "WORLD: Sent CMSG_GAMEOBJECT_QUERY " ); + sLog.outDebug( "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE" ); } } @@ -319,7 +318,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4+8); + CHECK_PACKET_SIZE(recv_data, 4 + 8); uint32 textID; uint64 guid; @@ -354,7 +353,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) else { std::string Text_0[8], Text_1[8]; - for (int i=0;i<8;++i) + for (int i = 0; i < 8; ++i) { Text_0[i]=pGossip->Options[i].Text_0; Text_1[i]=pGossip->Options[i].Text_1; @@ -366,7 +365,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID); if (nl) { - for (int i=0;i<8;++i) + for (int i = 0; i < 8; ++i) { if (nl->Text_0[i].size() > loc_idx && !nl->Text_0[i][loc_idx].empty()) Text_0[i]=nl->Text_0[i][loc_idx]; @@ -376,7 +375,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) } } - for (int i=0; i<8; ++i) + for (int i = 0; i < 8; ++i) { data << pGossip->Options[i].Probability; @@ -402,12 +401,12 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE " ); + sLog.outDebug( "WORLD: Sent SMSG_NPC_TEXT_UPDATE" ); } -void WorldSession::HandlePageQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandlePageTextQueryOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,4); + CHECK_PACKET_SIZE(recv_data, 4); uint32 pageID; @@ -448,7 +447,7 @@ void WorldSession::HandlePageQueryOpcode( WorldPacket & recv_data ) } SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE " ); + sLog.outDebug( "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE" ); } } diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index bc3f2a8fb37..74839bac1c3 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -114,7 +114,7 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data ) void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); uint64 guid; uint32 quest; @@ -123,7 +123,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) if(!GetPlayer()->isAlive()) return; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest ); + sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest ); Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER); @@ -208,14 +208,14 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) _player->PlayerTalkClass->CloseGossip(); } -void WorldSession::HandleQuestgiverQuestQueryOpcode( WorldPacket & recv_data ) +void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); uint64 guid; uint32 quest; recv_data >> guid >> quest; - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u",uint32(GUID_LOPART(guid)),quest ); + sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest ); // Verify that the guid is valid and is a questgiver or involved in the requested quest Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM); @@ -389,7 +389,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recv_data) sLog.outDebug( "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u",quest ); } -void WorldSession::HandleQuestComplete(WorldPacket& recv_data) +void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) { CHECK_PACKET_SIZE(recv_data,8+4); @@ -423,12 +423,12 @@ void WorldSession::HandleQuestComplete(WorldPacket& recv_data) } } -void WorldSession::HandleQuestAutoLaunch(WorldPacket& /*recvPacket*/) +void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/) { - sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH (Send your log to anakin if you see this message)" ); + sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH" ); } -void WorldSession::HandleQuestPushToParty(WorldPacket& recvPacket) +void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) { CHECK_PACKET_SIZE(recvPacket,4); @@ -604,7 +604,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 return result; } -void WorldSession::HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& /*recvPacket*/) +void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/) { sLog.outDebug("WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); diff --git a/src/game/SkillHandler.cpp b/src/game/SkillHandler.cpp index 2e1f09aaf5a..950fc985173 100644 --- a/src/game/SkillHandler.cpp +++ b/src/game/SkillHandler.cpp @@ -38,7 +38,7 @@ void WorldSession::HandleLearnTalentOpcode( WorldPacket & recv_data ) _player->LearnTalent(talent_id, requested_rank); } -void WorldSession::HandleTalentWipeOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8); @@ -49,7 +49,7 @@ void WorldSession::HandleTalentWipeOpcode( WorldPacket & recv_data ) Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER); if (!unit) { - sLog.outDebug( "WORLD: HandleTalentWipeOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug( "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); return; } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 299aac060ae..d04d4ab58fd 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -49,7 +49,7 @@ #include "Util.h" #include "TemporarySummon.h" -#define SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS) +#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS) extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS]; @@ -212,11 +212,11 @@ void SpellCastTargets::Update(Unit* caster) { m_GOTarget = m_GOTargetGUID ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL; m_unitTarget = m_unitTargetGUID ? - ( m_unitTargetGUID==caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) : + ( m_unitTargetGUID == caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) : NULL; m_itemTarget = NULL; - if(caster->GetTypeId()==TYPEID_PLAYER) + if(caster->GetTypeId() == TYPEID_PLAYER) { if(m_targetMask & TARGET_FLAG_ITEM) m_itemTarget = ((Player*)caster)->GetItemByGuid(m_itemTargetGUID); @@ -234,7 +234,7 @@ void SpellCastTargets::Update(Unit* caster) bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) { - if(data->rpos()+4 > data->size()) + if(data->rpos() + 4 > data->size()) return false; //data->hexlike(); @@ -264,7 +264,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) { - if(data->rpos()+4+4+4 > data->size()) + if(data->rpos() + 4 + 4 + 4 > data->size()) return false; *data >> m_srcX >> m_srcY >> m_srcZ; @@ -274,7 +274,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_DEST_LOCATION ) { - if(data->rpos()+1+4+4+4 > data->size()) + if(data->rpos() + 1 + 4 + 4 + 4 > data->size()) return false; if(!data->readPackGUID(m_unitTargetGUID)) @@ -287,7 +287,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) if( m_targetMask & TARGET_FLAG_STRING ) { - if(data->rpos()+1 > data->size()) + if(data->rpos() + 1 > data->size()) return false; *data >> m_strTarget; @@ -395,7 +395,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi if(m_attackType == RANGED_ATTACK) { // wand case - if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId()==TYPEID_PLAYER) + if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) { if(Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK)) m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType); @@ -409,11 +409,11 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi else m_originalCasterGUID = m_caster->GetGUID(); - if(m_originalCasterGUID==m_caster->GetGUID()) + if(m_originalCasterGUID == m_caster->GetGUID()) m_originalCaster = m_caster; else { - m_originalCaster = ObjectAccessor::GetUnit(*m_caster,m_originalCasterGUID); + m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID); if(m_originalCaster && !m_originalCaster->IsInWorld()) m_originalCaster = NULL; } @@ -453,12 +453,12 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED)) { - for(int j=0;j<3;j++) + for(int j = 0;j < 3; ++j) { - if (m_spellInfo->Effect[j]==0) + if (m_spellInfo->Effect[j] == 0) continue; - if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j],m_spellInfo->EffectImplicitTargetB[j])) + if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j])) m_canReflect = true; else m_canReflect = (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NEGATIVE) ? true : false; @@ -586,8 +586,8 @@ void Spell::FillTargetMap() else { // clear cooldown at fail - if(m_caster->GetTypeId()==TYPEID_PLAYER) - ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true); + if(m_caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true); SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES); finish(false); } @@ -631,7 +631,7 @@ void Spell::FillTargetMap() AddUnitTarget(m_targets.getUnitTarget(), i); if(m_targets.getCorpseTargetGUID()) { - Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID()); + Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID()); if(corpse) { Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID()); @@ -813,7 +813,7 @@ void Spell::CleanupTargetList() void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) { - if( m_spellInfo->Effect[effIndex]==0 ) + if( m_spellInfo->Effect[effIndex] == 0 ) return; if(!CheckTarget(pVictim, effIndex)) @@ -825,12 +825,12 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) uint64 targetGUID = pVictim->GetGUID(); // Lookup target in already in list - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (targetGUID == ihit->targetGUID) // Found in list { if (!immuned) - ihit->effectMask |= 1<<effIndex; // Add only effect mask if not immuned + ihit->effectMask |= 1 << effIndex; // Add only effect mask if not immuned return; } } @@ -840,7 +840,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) // Get spell hit result on target TargetInfo target; target.targetGUID = targetGUID; // Store target GUID - target.effectMask = immuned ? 0 : 1<<effIndex; // Store index of effect if not immuned + target.effectMask = immuned ? 0 : 1 << effIndex; // Store index of effect if not immuned target.processed = false; // Effects not apply on target target.alive = pVictim->isAlive(); target.damage = 0; @@ -866,14 +866,14 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f); // Calculate minimum incoming time - if (m_delayMoment==0 || m_delayMoment>target.timeDelay) + if (m_delayMoment == 0 || m_delayMoment>target.timeDelay) m_delayMoment = target.timeDelay; } else target.timeDelay = 0LL; // If target reflect spell back to caster - if (target.missCondition==SPELL_MISS_REFLECT) + if (target.missCondition == SPELL_MISS_REFLECT) { // Calculate reflected spell result on caster target.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); @@ -882,7 +882,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) target.reflectResult = SPELL_MISS_PARRY; // Increase time interval for reflected spells by 1.5 - target.timeDelay+=target.timeDelay>>1; + target.timeDelay += target.timeDelay >> 1; } else target.reflectResult = SPELL_MISS_NONE; @@ -893,24 +893,24 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex) void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex) { - Unit* unit = m_caster->GetGUID()==unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID); + Unit* unit = m_caster->GetGUID() == unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID); if (unit) AddUnitTarget(unit, effIndex); } void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex) { - if( m_spellInfo->Effect[effIndex]==0 ) + if( m_spellInfo->Effect[effIndex] == 0 ) return; uint64 targetGUID = pVictim->GetGUID(); // Lookup target in already in list - for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) + for(std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) { if (targetGUID == ihit->targetGUID) // Found in list { - ihit->effectMask |= 1<<effIndex; // Add only effect mask + ihit->effectMask |= 1 << effIndex; // Add only effect mask return; } } @@ -919,7 +919,7 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex) GOTargetInfo target; target.targetGUID = targetGUID; - target.effectMask = 1<<effIndex; + target.effectMask = 1 << effIndex; target.processed = false; // Effects not apply on target // Spell have speed - need calculate incoming time @@ -948,11 +948,11 @@ void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex) void Spell::AddItemTarget(Item* pitem, uint32 effIndex) { - if( m_spellInfo->Effect[effIndex]==0 ) + if( m_spellInfo->Effect[effIndex] == 0 ) return; // Lookup target in already in list - for(std::list<ItemTargetInfo>::iterator ihit= m_UniqueItemInfo.begin();ihit != m_UniqueItemInfo.end();++ihit) + for(std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) { if (pitem == ihit->item) // Found in list { @@ -965,7 +965,7 @@ void Spell::AddItemTarget(Item* pitem, uint32 effIndex) ItemTargetInfo target; target.item = pitem; - target.effectMask = 1<<effIndex; + target.effectMask = 1 << effIndex; m_UniqueItemInfo.push_back(target); } @@ -1178,7 +1178,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if( !m_caster->IsFriendlyTo(unit) ) { // for delayed spells ignore not visible explicit target - if(m_spellInfo->speed > 0.0f && unit==m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false)) + if(m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false)) { return SPELL_MISS_EVADE; } @@ -1376,9 +1376,9 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) if(!go) return; - for(uint32 effectNumber=0;effectNumber<3;effectNumber++) - if (effectMask & (1<<effectNumber)) - HandleEffects(NULL,NULL,go,effectNumber); + for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber) + if (effectMask & (1 << effectNumber)) + HandleEffects(NULL, NULL, go, effectNumber); // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) @@ -1395,8 +1395,8 @@ void Spell::DoAllEffectOnTarget(ItemTargetInfo *target) if(!target->item || !effectMask) return; - for(uint32 effectNumber=0;effectNumber<3;effectNumber++) - if (effectMask & (1<<effectNumber)) + for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber) + if (effectMask & (1 << effectNumber)) HandleEffects(NULL, target->item, NULL, effectNumber); } @@ -1414,11 +1414,11 @@ bool Spell::UpdateChanneledTargetList() needAuraMask &= needAliveTargetMask; - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) ) { - Unit *unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + Unit *unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit && unit->isAlive()) { @@ -1446,7 +1446,7 @@ bool Spell::UpdateChanneledTargetList() } // is all effects from m_needAliveTargetMask have alive targets - return needAliveTargetMask==0; + return needAliveTargetMask == 0; } // Helper for Chain Healing @@ -2769,15 +2769,15 @@ void Spell::_handle_immediate_phase() HandleThreatSpells(m_spellInfo->Id); m_needSpellLog = IsNeedSendToClient(); - for(uint32 j = 0;j<3;j++) + for(uint32 j = 0; j < 3; ++j) { - if(m_spellInfo->Effect[j]==0) + if(m_spellInfo->Effect[j] == 0) continue; // apply Send Event effect to ground in case empty target lists if( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j) ) { - HandleEffects(NULL,NULL,NULL, j); + HandleEffects(NULL, NULL, NULL, j); continue; } @@ -2927,20 +2927,20 @@ void Spell::update(uint32 difftime) { if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) { - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { TargetInfo* target = &*ihit; if(!IS_CREATURE_GUID(target->targetGUID)) continue; - Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID); - if (unit==NULL) + Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID); + if (unit == NULL) continue; - p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(unit->GetEntry(), unit->GetGUID(), m_spellInfo->Id); } - for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit) + for(std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) { GOTargetInfo* target = &*ihit; @@ -2948,7 +2948,7 @@ void Spell::update(uint32 difftime) if(!go) continue; - p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); + p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id); } } } @@ -3301,33 +3301,35 @@ void Spell::WriteSpellGoTargets( WorldPacket * data ) // m_needAliveTargetMask req for stop channelig if one target die uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO uint32 miss = 0; - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if ((*ihit).effectMask == 0) // No effect apply - all immuned add state { // possibly SPELL_MISS_IMMUNE2 for this?? ihit->missCondition = SPELL_MISS_IMMUNE2; - miss++; + ++miss; } else if ((*ihit).missCondition == SPELL_MISS_NONE) - hit++; + ++hit; else - miss++; + ++miss; } *data << (uint8)hit; - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + { if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits { *data << uint64(ihit->targetGUID); m_needAliveTargetMask |=ihit->effectMask; } + } - for(std::list<GOTargetInfo>::iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit) + for(std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit) *data << uint64(ighit->targetGUID); // Always hits *data << (uint8)miss; - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss { @@ -3472,8 +3474,8 @@ void Spell::SendChannelUpdate(uint32 time) { if(time == 0) { - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT,0); - m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL,0); + m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0); + m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0); } if (m_caster->GetTypeId() != TYPEID_PLAYER) @@ -3493,9 +3495,9 @@ void Spell::SendChannelStart(uint32 duration) // select first not resisted target from target list for _0_ effect if(!m_UniqueTargetInfo.empty()) { - for(std::list<TargetInfo>::iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr) + for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) { - if( (itr->effectMask & (1<<0)) && itr->reflectResult==SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID()) + if( (itr->effectMask & (1 << 0)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID()) { target = ObjectAccessor::GetUnit(*m_caster, itr->targetGUID); break; @@ -3504,9 +3506,9 @@ void Spell::SendChannelStart(uint32 duration) } else if(!m_UniqueGOTargetInfo.empty()) { - for(std::list<GOTargetInfo>::iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr) + for(std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) { - if(itr->effectMask & (1<<0) ) + if(itr->effectMask & (1 << 0) ) { target = m_caster->GetMap()->GetGameObject(itr->targetGUID); break; @@ -3535,16 +3537,16 @@ void Spell::SendResurrectRequest(Player* target) // Both players and NPCs can resurrect using spells - have a look at creature 28487 for example // However, the packet structure differs slightly - const char* sentName = m_caster->GetTypeId()==TYPEID_PLAYER ?"":m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()); + const char* sentName = m_caster->GetTypeId() == TYPEID_PLAYER ? "" : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()); WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+strlen(sentName)+1+1+1)); data << uint64(m_caster->GetGUID()); - data << uint32(strlen(sentName)+1); + data << uint32(strlen(sentName) + 1); data << sentName; data << uint8(0); - data << uint8(m_caster->GetTypeId()==TYPEID_PLAYER ?0:1); + data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1); target->GetSession()->SendPacket(&data); } @@ -3553,7 +3555,7 @@ void Spell::SendPlaySpellVisual(uint32 SpellID) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); + WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); data << uint64(m_caster->GetGUID()); data << uint32(SpellID); // spell visual id? ((Player*)m_caster)->GetSession()->SendPacket(&data); @@ -3826,7 +3828,7 @@ void Spell::TakeReagents() if (p_caster->CanNoReagentCast(m_spellInfo)) return; - for(uint32 x=0;x<8;x++) + for(uint32 x = 0; x < 8; ++x) { if(m_spellInfo->Reagent[x] <= 0) continue; @@ -3840,7 +3842,7 @@ void Spell::TakeReagents() ItemPrototype const *proto = m_CastItem->GetProto(); if( proto && proto->ItemId == itemid ) { - for(int s=0;s < MAX_ITEM_PROTO_SPELLS; ++s) + for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); @@ -3856,7 +3858,7 @@ void Spell::TakeReagents() } // if getItemTarget is also spell reagent - if (m_targets.getItemTargetEntry()==itemid) + if (m_targets.getItemTargetEntry() == itemid) m_targets.setItemTarget(NULL); p_caster->DestroyItemCount(itemid, itemcount, true); @@ -4034,7 +4036,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(target->getLevel() + 10 < m_spellInfo->spellLevel) return SPELL_FAILED_LOWLEVEL; } - else if (m_caster->GetTypeId()==TYPEID_PLAYER) // Target - is player caster + else if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster { // Additional check for some spells // If 0 spell effect empty - client not send target data (need use selection) @@ -4050,7 +4052,7 @@ SpellCastResult Spell::CheckCast(bool strict) } // check pet presents - for(int j=0;j<3;j++) + for(int j = 0; j < 3; ++j) { if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_PET) { @@ -4072,7 +4074,7 @@ SpellCastResult Spell::CheckCast(bool strict) { if(!CheckTargetCreatureType(target)) { - if(target->GetTypeId()==TYPEID_PLAYER) + if(target->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_TARGET_IS_PLAYER; else return SPELL_FAILED_BAD_TARGETS; @@ -4081,7 +4083,7 @@ SpellCastResult Spell::CheckCast(bool strict) // TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result. // check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc - if(m_caster != target && m_caster->GetTypeId()==TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID()) + if(m_caster != target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID()) { // check correctness positive/negative cast target (pet cast real check and cheating check) if(IsPositiveSpell(m_spellInfo->Id)) @@ -4125,7 +4127,7 @@ SpellCastResult Spell::CheckCast(bool strict) } // Spell casted only on battleground - if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId()==TYPEID_PLAYER) + if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER) if(!((Player*)m_caster)->InBattleGround()) return SPELL_FAILED_ONLY_BATTLEGROUNDS; @@ -4171,7 +4173,7 @@ SpellCastResult Spell::CheckCast(bool strict) /*//ImpliciteTargetA-B = 38, If fact there is 0 Spell with ImpliciteTargetB=38 if(m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example) { - for(uint8 j = 0; j < 3; j++) + for(uint8 j = 0; j < 3; ++j) { if( m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY || m_spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER || @@ -4218,7 +4220,7 @@ SpellCastResult Spell::CheckCast(bool strict) range = go_check.GetLastRange(); } } - else if( focusObject ) //Focus Object + else if( focusObject ) // Focus Object { float frange = m_caster->GetDistance(focusObject); if(range >= frange) @@ -4330,7 +4332,7 @@ SpellCastResult Spell::CheckCast(bool strict) if(m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; } - else if(m_spellInfo->SpellIconID==156) // Holy Shock + else if(m_spellInfo->SpellIconID == 156) // Holy Shock { // spell different for friends and enemies // hart version required facing @@ -4418,7 +4420,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects) if(m_caster->GetTypeId() == TYPEID_PLAYER) if(Unit* target = m_targets.getUnitTarget()) - if(target!=m_caster && target->getPowerType()!=m_spellInfo->EffectMiscValue[i]) + if(target != m_caster && target->getPowerType() != m_spellInfo->EffectMiscValue[i]) return SPELL_FAILED_BAD_TARGETS; break; } @@ -4447,14 +4449,14 @@ SpellCastResult Spell::CheckCast(bool strict) int32 skillValue = ((Player*)m_caster)->GetSkillValue(skill); int32 TargetLevel = m_targets.getUnitTarget()->getLevel(); - int32 ReqValue = (skillValue < 100 ? (TargetLevel-10)*10 : TargetLevel*5); + int32 ReqValue = (skillValue < 100 ? (TargetLevel-10) * 10 : TargetLevel * 5); if (ReqValue > skillValue) return SPELL_FAILED_LOW_CASTLEVEL; // chance for fail at orange skinning attempt if( (m_selfContainer && (*m_selfContainer) == this) && skillValue < sWorld.GetConfigMaxSkillValue() && - (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue-25, skillValue+37) ) + (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37) ) return SPELL_FAILED_TRY_AGAIN; break; @@ -4481,17 +4483,17 @@ SpellCastResult Spell::CheckCast(bool strict) // get the lock entry uint32 lockId = 0; - if (GameObject* go=m_targets.getGOTarget()) + if (GameObject* go = m_targets.getGOTarget()) lockId = go->GetLockId(); - else if(Item* itm=m_targets.getItemTarget()) + else if(Item* itm = m_targets.getItemTarget()) lockId = itm->GetProto()->LockID; - SkillType skillId =SKILL_NONE; + SkillType skillId = SKILL_NONE; int32 reqSkillValue = 0; int32 skillValue = 0; // check lock compatibility - SpellCastResult res = CanOpenLock(i,lockId,skillId,reqSkillValue,skillValue); + SpellCastResult res = CanOpenLock(i, lockId, skillId, reqSkillValue, skillValue); if(res != SPELL_CAST_OK) return res; @@ -4502,7 +4504,7 @@ SpellCastResult Spell::CheckCast(bool strict) bool canFailAtMax = skillId != SKILL_HERBALISM && skillId != SKILL_MINING; // chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill) - if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue-25, skillValue+37)) + if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37)) return SPELL_FAILED_TRY_AGAIN; } break; @@ -4568,13 +4570,13 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_SUMMON_PLAYER: { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_BAD_TARGETS; if(!((Player*)m_caster)->GetSelection()) return SPELL_FAILED_BAD_TARGETS; Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection()); - if( !target || ((Player*)m_caster)==target || !target->IsInSameRaidWith((Player*)m_caster) ) + if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) ) return SPELL_FAILED_BAD_TARGETS; // check if our map is dungeon @@ -4600,7 +4602,7 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_STEAL_BENEFICIAL_BUFF: { - if (m_targets.getUnitTarget()==m_caster) + if (m_targets.getUnitTarget() == m_caster) return SPELL_FAILED_BAD_TARGETS; break; } @@ -4618,7 +4620,7 @@ SpellCastResult Spell::CheckCast(bool strict) switch(m_spellInfo->Id) { case 61336: - if(m_caster->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm()) + if(m_caster->GetTypeId() != TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm()) return SPELL_FAILED_ONLY_SHAPESHIFT; break; case 1515: @@ -4674,11 +4676,11 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; - if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetTransport()) + if (m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->GetTransport()) return SPELL_FAILED_NO_MOUNTS_ALLOWED; // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells - if (m_caster->GetTypeId()==TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId) + if (m_caster->GetTypeId() == TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId) return SPELL_FAILED_NO_MOUNTS_ALLOWED; ShapeshiftForm form = m_caster->m_form; @@ -4717,10 +4719,10 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_targets.getUnitTarget()) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; - if (m_caster->GetTypeId()!=TYPEID_PLAYER || m_CastItem) + if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem) break; - if(m_targets.getUnitTarget()->getPowerType()!=POWER_MANA) + if(m_targets.getUnitTarget()->getPowerType() != POWER_MANA) return SPELL_FAILED_BAD_TARGETS; break; @@ -4786,18 +4788,18 @@ SpellCastResult Spell::CheckCasterAuras() const // Flag drop spells totally immuned to caster auras // FIXME: find more nice check for all totally immuned spells // AttributesEx3 & 0x10000000? - if(m_spellInfo->Id==23336 || m_spellInfo->Id==23334 || m_spellInfo->Id==34991) + if(m_spellInfo->Id == 23336 || m_spellInfo->Id == 23334 || m_spellInfo->Id == 34991) return SPELL_CAST_OK; uint8 school_immune = 0; uint32 mechanic_immune = 0; uint32 dispel_immune = 0; - //Check if the spell grants school or mechanic immunity. - //We use bitmasks so the loop is done only once and not on every aura check below. + // Check if the spell grants school or mechanic immunity. + // We use bitmasks so the loop is done only once and not on every aura check below. if ( m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY ) { - for(int i = 0;i < 3; i ++) + for(int i = 0; i < 3; ++i) { if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY) school_immune |= uint32(m_spellInfo->EffectMiscValue[i]); @@ -4811,7 +4813,7 @@ SpellCastResult Spell::CheckCasterAuras() const mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; } - //Check whether the cast should be prevented by any state you might have. + // Check whether the cast should be prevented by any state you might have. SpellCastResult prevented_reason = SPELL_CAST_OK; // Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state @@ -4821,9 +4823,9 @@ SpellCastResult Spell::CheckCasterAuras() const prevented_reason = SPELL_FAILED_CONFUSED; else if(unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED)) prevented_reason = SPELL_FAILED_FLEEING; - else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) + else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) prevented_reason = SPELL_FAILED_SILENCED; - else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) + else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) prevented_reason = SPELL_FAILED_PACIFIED; // Attr must make flag drop spell totally immune from all effects @@ -4878,7 +4880,7 @@ SpellCastResult Spell::CheckCasterAuras() const } } } - //You are prevented from casting and the spell casted does not grant immunity. Return a failed error. + // You are prevented from casting and the spell casted does not grant immunity. Return a failed error. else return prevented_reason; } @@ -4889,7 +4891,7 @@ bool Spell::CanAutoCast(Unit* target) { uint64 targetguid = target->GetGUID(); - for(uint32 j = 0;j<3;j++) + for(uint32 j = 0; j < 3; ++j) { if(m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) { @@ -4975,9 +4977,9 @@ SpellCastResult Spell::CheckRange(bool strict) if(m_targets.m_targetMask == TARGET_FLAG_DEST_LOCATION && m_targets.m_destX != 0 && m_targets.m_destY != 0 && m_targets.m_destZ != 0) { - if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,max_range)) + if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, max_range)) return SPELL_FAILED_OUT_OF_RANGE; - if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,min_range)) + if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, min_range)) return SPELL_FAILED_TOO_CLOSE; } @@ -5099,16 +5101,16 @@ SpellCastResult Spell::CheckItems() else { uint32 itemid = m_CastItem->GetEntry(); - if( !p_caster->HasItemCount(itemid,1) ) + if( !p_caster->HasItemCount(itemid, 1) ) return SPELL_FAILED_ITEM_NOT_READY; ItemPrototype const *proto = m_CastItem->GetProto(); if(!proto) return SPELL_FAILED_ITEM_NOT_READY; - for (int i = 0; i<5; i++) + for (int i = 0; i < 5; ++i) if (proto->Spells[i].SpellCharges) - if(m_CastItem->GetSpellCharges(i)==0) + if(m_CastItem->GetSpellCharges(i) == 0) return SPELL_FAILED_NO_CHARGES_REMAIN; // consumable cast item checks @@ -5191,7 +5193,7 @@ SpellCastResult Spell::CheckItems() GameObject* ok = NULL; MaNGOS::GameObjectFocusCheck go_check(m_caster,m_spellInfo->RequiresSpellFocus); - MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(m_caster,ok,go_check); + MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(m_caster, ok, go_check); TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker); CellLock<GridReadGuard> cell_lock(cell, p); @@ -5241,7 +5243,7 @@ SpellCastResult Spell::CheckItems() // check totem-item requirements (items presence in inventory) uint32 totems = 2; - for(int i=0;i<2;++i) + for(int i = 0; i < 2 ; ++i) { if(m_spellInfo->Totem[i] != 0) { @@ -5258,7 +5260,7 @@ SpellCastResult Spell::CheckItems() // Check items for TotemCategory (items presence in inventory) uint32 TotemCategory = 2; - for(int i=0;i<2;++i) + for(int i= 0; i < 2; ++i) { if(m_spellInfo->TotemCategory[i] != 0) { @@ -5470,11 +5472,11 @@ SpellCastResult Spell::CheckItems() { case ITEM_SUBCLASS_WEAPON_BOW: case ITEM_SUBCLASS_WEAPON_CROSSBOW: - if(ammoProto->SubClass!=ITEM_SUBCLASS_ARROW) + if(ammoProto->SubClass != ITEM_SUBCLASS_ARROW) return SPELL_FAILED_NO_AMMO; break; case ITEM_SUBCLASS_WEAPON_GUN: - if(ammoProto->SubClass!=ITEM_SUBCLASS_BULLET) + if(ammoProto->SubClass != ITEM_SUBCLASS_BULLET) return SPELL_FAILED_NO_AMMO; break; default: @@ -5485,6 +5487,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_WAND: + break; default: break; } @@ -5547,7 +5550,7 @@ void Spell::Delayed() // only called in DealDamage() //check pushback reduce int32 delaytime = 500; // spellcasting delay is normally 500ms int32 delayReduce = 100; // must be initialized to 100 for percent modifiers - ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); + ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; if(delayReduce >= 100) return; @@ -5562,13 +5565,13 @@ void Spell::Delayed() // only called in DealDamage() else m_timer += delaytime; - sLog.outDetail("Spell %u partially interrupted for (%d) ms at damage",m_spellInfo->Id,delaytime); + sLog.outDetail("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); WorldPacket data(SMSG_SPELL_DELAYED, 8+4); data.append(m_caster->GetPackGUID()); data << uint32(delaytime); - m_caster->SendMessageToSet(&data,true); + m_caster->SendMessageToSet(&data, true); } void Spell::DelayedChannel() @@ -5582,7 +5585,7 @@ void Spell::DelayedChannel() //check pushback reduce int32 delaytime = GetSpellDuration(m_spellInfo) * 25 / 100; // channeling delay is normally 25% of its time per hit int32 delayReduce = 100; // must be initialized to 100 for percent modifiers - ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,delayReduce, this); + ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; if(delayReduce >= 100) return; @@ -5599,11 +5602,11 @@ void Spell::DelayedChannel() sLog.outDebug("Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); - for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if ((*ihit).missCondition == SPELL_MISS_NONE) { - Unit* unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit) { unit->DelayAura(m_spellInfo->Id, m_caster->GetGUID(), delaytime); @@ -5611,7 +5614,7 @@ void Spell::DelayedChannel() } } - for(int j = 0; j < 3; j++) + for(int j = 0; j < 3; ++j) { // partially interrupt persistent area auras DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id, j); @@ -5680,7 +5683,7 @@ CurrentSpellTypes Spell::GetCurrentContainer() bool Spell::CheckTarget(Unit* target, uint32 eff) { // Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets) - if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_UNIT_CASTER) + if(m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_CASTER) { if (!CheckTargetCreatureType(target)) return false; @@ -5709,9 +5712,9 @@ bool Spell::CheckTarget(Unit* target, uint32 eff) } //Check player targets and remove if in GM mode or GM invisibility (for not self casting case) - if( target != m_caster && target->GetTypeId()==TYPEID_PLAYER) + if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER) { - if(((Player*)target)->GetVisibility()==VISIBILITY_OFF) + if(((Player*)target)->GetVisibility() == VISIBILITY_OFF) return false; if(((Player*)target)->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id)) @@ -5728,21 +5731,21 @@ bool Spell::CheckTarget(Unit* target, uint32 eff) case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere break; case SPELL_EFFECT_DUMMY: - if(m_spellInfo->Id!=20577) // Cannibalize + if(m_spellInfo->Id != 20577) // Cannibalize break; //fall through case SPELL_EFFECT_RESURRECT_NEW: // player far away, maybe his corpse near? - if(target!=m_caster && !target->IsWithinLOSInMap(m_caster)) + if(target != m_caster && !target->IsWithinLOSInMap(m_caster)) { if(!m_targets.getCorpseTargetGUID()) return false; - Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID()); + Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID()); if(!corpse) return false; - if(target->GetGUID()!=corpse->GetOwnerGUID()) + if(target->GetGUID() != corpse->GetOwnerGUID()) return false; if(!corpse->IsWithinLOSInMap(m_caster)) @@ -5758,7 +5761,7 @@ bool Spell::CheckTarget(Unit* target, uint32 eff) caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); if (!caster) caster = m_caster; - if(target!=m_caster && !target->IsWithinLOSInMap(caster)) + if(target != m_caster && !target->IsWithinLOSInMap(caster)) return false; break; } @@ -5774,16 +5777,16 @@ bool Spell::IsNeedSendToClient() const bool Spell::HaveTargetsForEffect( uint8 effect ) const { - for(std::list<TargetInfo>::const_iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr) - if(itr->effectMask & (1<<effect)) + for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) + if(itr->effectMask & (1 << effect)) return true; - for(std::list<GOTargetInfo>::const_iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr) - if(itr->effectMask & (1<<effect)) + for(std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) + if(itr->effectMask & (1 << effect)) return true; - for(std::list<ItemTargetInfo>::const_iterator itr= m_UniqueItemInfo.begin();itr != m_UniqueItemInfo.end();++itr) - if(itr->effectMask & (1<<effect)) + for(std::list<ItemTargetInfo>::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr) + if(itr->effectMask & (1 << effect)) return true; return false; @@ -5806,7 +5809,7 @@ SpellEvent::~SpellEvent() else { sLog.outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", - (m_Spell->GetCaster()->GetTypeId()==TYPEID_PLAYER?"Player":"Creature"), m_Spell->GetCaster()->GetGUIDLow(),m_Spell->m_spellInfo->Id); + (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); } } @@ -5825,8 +5828,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) if (m_Spell->IsDeletable()) { // check, if we do have unfinished triggered spells - - return(true); // spell is deletable, finish event + return true; // spell is deletable, finish event } // event will be re-added automatically at the end of routine) } break; @@ -5863,7 +5865,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) { // re-add us to the queue m_Spell->GetCaster()->m_Events.AddEvent(this, m_Spell->GetDelayStart() + n_offset, false); - return(false); // event not complete + return false; // event not complete } // event complete // finish update event will be re-added automatically at the end of routine) @@ -5875,7 +5877,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) m_Spell->SetDelayStart(e_time); // re-plan the event for the delay moment m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + m_Spell->GetDelayMoment(), false); - return(false); // event not complete + return false; // event not complete } } break; @@ -5888,7 +5890,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time) // spell processing not complete, plan event on the next update interval m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + 1, false); - return(false); // event not complete + return false; // event not complete } void SpellEvent::Abort(uint64 /*e_time*/) diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index 494bdc68a88..8dd39552eb2 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -91,9 +91,9 @@ enum AuraType SPELL_AURA_PROC_TRIGGER_DAMAGE = 43, SPELL_AURA_TRACK_CREATURES = 44, SPELL_AURA_TRACK_RESOURCES = 45, - SPELL_AURA_46 = 46, // Ignore all Gear test spells + SPELL_AURA_46 = 46, // Ignore all Gear test spells SPELL_AURA_MOD_PARRY_PERCENT = 47, - SPELL_AURA_48 = 48, // One periodic spell + SPELL_AURA_48 = 48, // One periodic spell SPELL_AURA_MOD_DODGE_PERCENT = 49, SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50, SPELL_AURA_MOD_BLOCK_PERCENT = 51, @@ -135,7 +135,7 @@ enum AuraType SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87, SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88, SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89, - SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE + SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE SPELL_AURA_MOD_DETECT_RANGE = 91, SPELL_AURA_PREVENTS_FLEEING = 92, SPELL_AURA_MOD_UNATTACKABLE = 93, diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index bf760f6dea1..7ac2ae5f25e 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3734,7 +3734,7 @@ void AuraEffect::HandleAuraModPetTalentsPoints(bool Apply, bool Real, bool chang if(m_target->GetCharmInfo()) m_target->GetCharmInfo()->SetPetNumber(0, true); else - sLog.outError("AuraEffect::HandleModCharm: target="I64FMTD" with typeid=%d has a charm aura but no charm info!", m_target->GetGUID(), m_target->GetTypeId()); + sLog.outError("AuraEffect::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", m_target->GetGUID(), m_target->GetTypeId()); } } @@ -5892,18 +5892,8 @@ void AuraEffect::PeriodicTick() pCaster->DealDamageMods(m_target,pdamage,&absorb); - WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size - data.append(m_target->GetPackGUID()); - data.appendPackGUID(GetCasterGUID()); - data << uint32(GetId()); - data << uint32(1); - data << uint32(m_auraName); - data << (uint32)pdamage; - data << uint32(0); // overkill - data << (uint32)GetSpellSchoolMask(GetSpellProto()); // will be mask in 2.4.x - data << (uint32)absorb; - data << (uint32)resist; - m_target->SendMessageToSet(&data,true); + SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, absorb, resist, 0.0f); + m_target->SendPeriodicAuraLog(&pInfo); Unit* target = m_target; // aura can be deleted in DealDamage SpellEntry const* spellProto = GetSpellProto(); @@ -6030,15 +6020,8 @@ void AuraEffect::PeriodicTick() int32 gain = m_target->ModifyHealth(pdamage); - WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size - data.append(m_target->GetPackGUID()); - data.appendPackGUID(GetCasterGUID()); - data << uint32(GetId()); - data << uint32(1); - data << uint32(m_auraName); - data << (uint32)pdamage; - data << uint32(pdamage - gain); // wotlk - m_target->SendMessageToSet(&data,true); + SpellPeriodicAuraLogInfo pInfo(this, pdamage, pdamage - gain, 0, 0, 0.0f); + m_target->SendPeriodicAuraLog(&pInfo); // add HoTs to amount healed in bgs if( pCaster->GetTypeId() == TYPEID_PLAYER ) @@ -6152,16 +6135,8 @@ void AuraEffect::PeriodicTick() modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier); } - WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size - data.append(m_target->GetPackGUID()); - data.appendPackGUID(GetCasterGUID()); - data << uint32(GetId()); - data << uint32(1); - data << uint32(m_auraName); - data << (uint32)power; // power type - data << (uint32)drain_amount; - data << (float)gain_multiplier; - m_target->SendMessageToSet(&data,true); + SpellPeriodicAuraLogInfo pInfo(this, drain_amount, 0, 0, 0, gain_multiplier); + m_target->SendPeriodicAuraLog(&pInfo); int32 gain_amount = int32(drain_amount*gain_multiplier); @@ -6215,15 +6190,8 @@ void AuraEffect::PeriodicTick() sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId()); - WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size - data.append(m_target->GetPackGUID()); - data.appendPackGUID(GetCasterGUID()); - data << uint32(GetId()); - data << uint32(1); - data << uint32(m_auraName); - data << uint32(power); // power type - data << (uint32)amount; - m_target->SendMessageToSet(&data,true); + SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f); + m_target->SendPeriodicAuraLog(&pInfo); int32 gain = m_target->ModifyPower(power,amount); @@ -6247,15 +6215,8 @@ void AuraEffect::PeriodicTick() uint32 amount = m_amount; - WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size - data.append(m_target->GetPackGUID()); - data.appendPackGUID(GetCasterGUID()); - data << uint32(GetId()); - data << uint32(1); - data << uint32(m_auraName); - data << (uint32)power; // power type - data << (uint32)amount; - m_target->SendMessageToSet(&data,true); + SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f); + m_target->SendPeriodicAuraLog(&pInfo); sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId()); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 59830551cf3..b99a6169161 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -276,14 +276,14 @@ void Spell::EffectInstaKill(uint32 /*i*/) case 1863: spellID=18791; break; //succubus case 17252: spellID=35701; break; //fellguard default: - sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.",entry); + sLog.outError("EffectInstaKill: Unhandled creature entry (%u) case.", entry); return; } - m_caster->CastSpell(m_caster,spellID,true); + m_caster->CastSpell(m_caster, spellID, true); } - if(m_caster==unitTarget) // prevent interrupt message + if(m_caster == unitTarget) // prevent interrupt message finish(); m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); @@ -299,11 +299,11 @@ void Spell::EffectEnvirinmentalDMG(uint32 i) // currently each enemy selected explicitly and self cast damage, we prevent apply self casted spell bonuses/etc damage = m_spellInfo->CalculateSimpleValue(i); - m_caster->CalcAbsorbResist(m_caster,GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo); + m_caster->CalcAbsorbResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist, m_spellInfo); m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false); if(m_caster->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE,damage); + ((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE, damage); } void Spell::EffectSchoolDMG(uint32 effect_idx) @@ -783,7 +783,7 @@ void Spell::EffectDummy(uint32 i) case 4: spell_id = 8067; break; // Party Time! case 5: spell_id = 8068; break; // Healthy Spirit } - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 8213: // Savory Deviate Delight @@ -805,7 +805,7 @@ void Spell::EffectDummy(uint32 i) case 8593: // Symbol of life (restore creature to life) case 31225: // Shimmering Vessel (restore creature to life) { - if(!unitTarget || unitTarget->GetTypeId()!=TYPEID_UNIT) + if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; ((Creature*)unitTarget)->setDeathState(JUST_ALIVED); return; @@ -889,18 +889,18 @@ void Spell::EffectDummy(uint32 i) } case 16589: // Noggenfogger Elixir { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = 0; - switch(urand(1,3)) + switch(urand(1, 3)) { case 1: spell_id = 16595; break; case 2: spell_id = 16593; break; default:spell_id = 16591; break; } - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 17251: // Spirit Healer Res @@ -911,7 +911,7 @@ void Spell::EffectDummy(uint32 i) if(m_originalCaster->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); - data << unitTarget->GetGUID(); + data << uint64(unitTarget->GetGUID()); ((Player*)m_originalCaster)->GetSession()->SendPacket( &data ); } return; @@ -923,12 +923,12 @@ void Spell::EffectDummy(uint32 i) uint32 spell_id = roll_chance_i(50) ? 17269 : 17270; - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 20577: // Cannibalize if (unitTarget) - m_caster->CastSpell(m_caster,20578,false,NULL); + m_caster->CastSpell(m_caster, 20578, false, NULL); return; case 23019: // Crystal Prison Dummy DND { @@ -948,49 +948,49 @@ void Spell::EffectDummy(uint32 i) WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); data << uint64(Crystal_Prison->GetGUID()); - m_caster->SendMessageToSet(&data,true); + m_caster->SendMessageToSet(&data, true); return; } case 23074: // Arcanite Dragonling if (!m_CastItem) return; - m_caster->CastSpell(m_caster,19804,true,m_CastItem); + m_caster->CastSpell(m_caster, 19804, true, m_CastItem); return; case 23075: // Mithril Mechanical Dragonling if (!m_CastItem) return; - m_caster->CastSpell(m_caster,12749,true,m_CastItem); + m_caster->CastSpell(m_caster, 12749, true, m_CastItem); return; case 23076: // Mechanical Dragonling if (!m_CastItem) return; - m_caster->CastSpell(m_caster,4073,true,m_CastItem); + m_caster->CastSpell(m_caster, 4073, true, m_CastItem); return; case 23133: // Gnomish Battle Chicken if (!m_CastItem) return; - m_caster->CastSpell(m_caster,13166,true,m_CastItem); + m_caster->CastSpell(m_caster, 13166, true, m_CastItem); return; case 23448: // Ultrasafe Transporter: Gadgetzan - backfires { int32 r = irand(0, 119); if ( r < 20 ) // 1/6 polymorph - m_caster->CastSpell(m_caster,23444,true); + m_caster->CastSpell(m_caster, 23444, true); else if ( r < 100 ) // 4/6 evil twin - m_caster->CastSpell(m_caster,23445,true); + m_caster->CastSpell(m_caster, 23445, true); else // 1/6 miss the target - m_caster->CastSpell(m_caster,36902,true); + m_caster->CastSpell(m_caster, 36902, true); return; } case 23453: // Ultrasafe Transporter: Gadgetzan if ( roll_chance_i(50) ) // success - m_caster->CastSpell(m_caster,23441,true); + m_caster->CastSpell(m_caster, 23441, true); else // failure - m_caster->CastSpell(m_caster,23446,true); + m_caster->CastSpell(m_caster, 23446, true); return; case 23645: // Hourglass Sand m_caster->RemoveAurasDueToSpell(23170); return; case 23725: // Gift of Life (warrior bwl trinket) - m_caster->CastSpell(m_caster,23782,true); - m_caster->CastSpell(m_caster,23783,true); + m_caster->CastSpell(m_caster, 23782, true); + m_caster->CastSpell(m_caster, 23783, true); return; case 25860: // Reindeer Transformation { @@ -1021,7 +1021,7 @@ void Spell::EffectDummy(uint32 i) case 28006: // Arcane Cloaking { if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER ) - m_caster->CastSpell(unitTarget,29294,true); + m_caster->CastSpell(unitTarget, 29294, true); return; } // Polarity Shift @@ -1086,7 +1086,7 @@ void Spell::EffectDummy(uint32 i) case 5: spell_id = 33064; break; } - m_caster->CastSpell(m_caster,spell_id,true,NULL); + m_caster->CastSpell(m_caster, spell_id, true, NULL); return; } case 35745: @@ -1099,7 +1099,7 @@ void Spell::EffectDummy(uint32 i) default: return; } - m_caster->CastSpell(m_caster,spell_id,true); + m_caster->CastSpell(m_caster, spell_id, true); return; } case 37674: // Chaos Blast @@ -1108,14 +1108,14 @@ void Spell::EffectDummy(uint32 i) return; int32 basepoints0 = 100; - m_caster->CastCustomSpell(unitTarget,37675,&basepoints0,NULL,NULL,true); + m_caster->CastCustomSpell(unitTarget, 37675, &basepoints0, NULL, NULL, true); return; } case 40802: // Mingo's Fortune Generator (Mingo's Fortune Giblets) { // selecting one from Bloodstained Fortune item uint32 newitemid; - switch(urand(1,20)) + switch(urand(1, 20)) { case 1: newitemid = 32688; break; case 2: newitemid = 32689; break; @@ -1141,7 +1141,7 @@ void Spell::EffectDummy(uint32 i) return; } - DoCreateItem(i,newitemid); + DoCreateItem(i, newitemid); return; } // Demon Broiled Surprise @@ -1167,7 +1167,7 @@ void Spell::EffectDummy(uint32 i) creatureTarget->SetHealth(0); // just for nice GM-mode view //cast spell Raptor Capture Credit - m_caster->CastSpell(m_caster,42337,true,NULL); + m_caster->CastSpell(m_caster, 42337, true, NULL); return; } case 34665: //Administer Antidote @@ -1195,7 +1195,7 @@ void Spell::EffectDummy(uint32 i) return; pCreature->SetHealth(health); - ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992,pCreature); + ((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992, pCreature); if (pCreature->IsAIEnabled) pCreature->AI()->AttackStart(m_caster); @@ -1285,7 +1285,7 @@ void Spell::EffectDummy(uint32 i) case 53341: case 53343: { - m_caster->CastSpell(m_caster,54586,true); + m_caster->CastSpell(m_caster, 54586, true); return; } case 58418: // Portal to Orgrimmar @@ -1312,7 +1312,7 @@ void Spell::EffectDummy(uint32 i) // FIXME: custom spell required this aura state by some unknown reason, we not need remove it anyway m_caster->ModifyAuraState(AURA_STATE_BERSERKING,true); - m_caster->CastCustomSpell(m_caster,26635,&hasteModBasePoints0,&hasteModBasePoints1,&hasteModBasePoints2,true,NULL); + m_caster->CastCustomSpell(m_caster, 26635, &hasteModBasePoints0, &hasteModBasePoints1, &hasteModBasePoints2, true, NULL); return; } } @@ -1340,7 +1340,7 @@ void Spell::EffectDummy(uint32 i) (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 ) { - ((Player*)m_caster)->RemoveSpellCooldown(classspell,true); + ((Player*)m_caster)->RemoveSpellCooldown(classspell, true); } } return; @@ -1362,7 +1362,7 @@ void Spell::EffectDummy(uint32 i) if(m_spellInfo->SpellFamilyFlags & 0x1 && m_spellInfo->SpellVisual[0] == 867) { int32 chargeBasePoints0 = damage; - m_caster->CastCustomSpell(m_caster,34846,&chargeBasePoints0,NULL,NULL,true); + m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true); return; } //Slam @@ -1425,7 +1425,7 @@ void Spell::EffectDummy(uint32 i) { if(!unitTarget) return; - m_caster->CastSpell(unitTarget,21887,true); // spell mod + m_caster->CastSpell(unitTarget, 21887, true);// spell mod return; } // Last Stand @@ -1602,7 +1602,7 @@ void Spell::EffectDummy(uint32 i) } case 31231: // Cheat Death { - m_caster->CastSpell(m_caster,45182,true); + m_caster->CastSpell(m_caster, 45182, true); return; } } @@ -1707,7 +1707,7 @@ void Spell::EffectDummy(uint32 i) ((Player*)m_caster)->AddSpellMod(mod, false); } else - m_caster->CastSpell(unitTarget,spell_proto,true,NULL); + m_caster->CastSpell(unitTarget, spell_proto, true, NULL); return; } @@ -1761,7 +1761,7 @@ void Spell::EffectDummy(uint32 i) default: return; // ignore for not healing classes } - m_caster->CastSpell(m_caster,spell_id,true); + m_caster->CastSpell(m_caster, spell_id, true); return; } } @@ -1780,7 +1780,7 @@ void Spell::EffectDummy(uint32 i) case 8019: spell_id = 36755; break; // Rank 3 case 10399: spell_id = 36759; break; // Rank 4 default: - sLog.outError("Spell::EffectDummy: Spell %u not handled in RW",m_spellInfo->Id); + sLog.outError("Spell::EffectDummy: Spell %u not handled in RW", m_spellInfo->Id); return; } @@ -1847,7 +1847,7 @@ void Spell::EffectDummy(uint32 i) damage+=dummy->GetAmount(); // Regenerate 6% of Total Mana Every 3 secs int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100; - m_caster->CastCustomSpell(unitTarget,39609,&EffectBasePoints0,NULL,NULL,true,NULL,NULL,m_originalCasterGUID); + m_caster->CastCustomSpell(unitTarget, 39609, &EffectBasePoints0, NULL, NULL, true, NULL, NULL, m_originalCasterGUID); return; } // Lava Lash @@ -1884,12 +1884,12 @@ void Spell::EffectDummy(uint32 i) return; int32 bp = damage * 1.5f; - m_caster->CastCustomSpell(unitTarget,47633,&bp,NULL,NULL,true); + m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true); } else { int32 bp = damage; - m_caster->CastCustomSpell(unitTarget,47632,&bp,NULL,NULL,true); + m_caster->CastCustomSpell(unitTarget, 47632, &bp, NULL, NULL, true); } return; } @@ -1993,7 +1993,7 @@ void Spell::EffectForceCast(uint32 i) return; } - unitTarget->CastSpell(unitTarget,spellInfo,true,NULL,NULL,m_originalCasterGUID); + unitTarget->CastSpell(unitTarget, spellInfo, true, NULL, NULL, m_originalCasterGUID); } void Spell::EffectTriggerSpell(uint32 i) @@ -2069,7 +2069,7 @@ void Spell::EffectTriggerSpell(uint32 i) return; for (int j=0; j < spell->StackAmount; ++j) - m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); + m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } // Mercurial Shield - (need add max stack of 26464 Mercurial Shield) @@ -2080,13 +2080,13 @@ void Spell::EffectTriggerSpell(uint32 i) return; for (int j=0; j < spell->StackAmount; ++j) - m_caster->CastSpell(unitTarget,spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); + m_caster->CastSpell(unitTarget, spell->Id, true, m_CastItem, NULL, m_originalCasterGUID); return; } // Righteous Defense case 31980: { - m_caster->CastSpell(unitTarget, 31790, true,m_CastItem,NULL,m_originalCasterGUID); + m_caster->CastSpell(unitTarget, 31790, true, m_CastItem, NULL, m_originalCasterGUID); return; } // Cloak of Shadows @@ -2264,9 +2264,9 @@ void Spell::EffectTeleportUnits(uint32 i) if ( r >= 70 ) // 7/12 success { if ( r < 100 ) // 4/12 evil twin - m_caster->CastSpell(m_caster,23445,true); + m_caster->CastSpell(m_caster, 23445, true); else // 1/12 fire - m_caster->CastSpell(m_caster,23449,true); + m_caster->CastSpell(m_caster, 23449, true); } return; } @@ -2275,41 +2275,41 @@ void Spell::EffectTeleportUnits(uint32 i) { if ( roll_chance_i(50) ) // 50% success { - int32 rand_eff = urand(1,7); + int32 rand_eff = urand(1, 7); switch ( rand_eff ) { case 1: // soul split - evil - m_caster->CastSpell(m_caster,36900,true); + m_caster->CastSpell(m_caster, 36900, true); break; case 2: // soul split - good - m_caster->CastSpell(m_caster,36901,true); + m_caster->CastSpell(m_caster, 36901, true); break; case 3: // Increase the size - m_caster->CastSpell(m_caster,36895,true); + m_caster->CastSpell(m_caster, 36895, true); break; case 4: // Decrease the size - m_caster->CastSpell(m_caster,36893,true); + m_caster->CastSpell(m_caster, 36893, true); break; case 5: // Transform { if (((Player*)m_caster)->GetTeam() == ALLIANCE ) - m_caster->CastSpell(m_caster,36897,true); + m_caster->CastSpell(m_caster, 36897, true); else - m_caster->CastSpell(m_caster,36899,true); + m_caster->CastSpell(m_caster, 36899, true); break; } case 6: // chicken - m_caster->CastSpell(m_caster,36940,true); + m_caster->CastSpell(m_caster, 36940, true); break; case 7: // evil twin - m_caster->CastSpell(m_caster,23445,true); + m_caster->CastSpell(m_caster, 23445, true); break; } } @@ -2320,28 +2320,28 @@ void Spell::EffectTeleportUnits(uint32 i) { if ( roll_chance_i(50) ) // 50% success { - int32 rand_eff = urand(1,4); + int32 rand_eff = urand(1, 4); switch ( rand_eff ) { case 1: // soul split - evil - m_caster->CastSpell(m_caster,36900,true); + m_caster->CastSpell(m_caster, 36900, true); break; case 2: // soul split - good - m_caster->CastSpell(m_caster,36901,true); + m_caster->CastSpell(m_caster, 36901, true); break; case 3: // Increase the size - m_caster->CastSpell(m_caster,36895,true); + m_caster->CastSpell(m_caster, 36895, true); break; case 4: // Transform { if (((Player*)m_caster)->GetTeam() == ALLIANCE ) - m_caster->CastSpell(m_caster,36897,true); + m_caster->CastSpell(m_caster, 36897, true); else - m_caster->CastSpell(m_caster,36899,true); + m_caster->CastSpell(m_caster, 36899, true); break; } } @@ -2422,11 +2422,11 @@ void Spell::EffectPowerDrain(uint32 i) if(Player *modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, manaMultiplier); - int32 gain = int32(new_damage*manaMultiplier); + int32 gain = int32(new_damage * manaMultiplier); m_caster->ModifyPower(POWER_MANA,gain); //send log - m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id,gain,POWER_MANA); + m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id, gain, POWER_MANA); } } @@ -2474,7 +2474,7 @@ void Spell::EffectPowerBurn(uint32 i) int32 new_damage = (curPower < power) ? curPower : power; - unitTarget->ModifyPower(powertype,-new_damage); + unitTarget->ModifyPower(powertype, -new_damage); float multiplier = m_spellInfo->EffectMultipleValue[i]; if(Player *modOwner = m_caster->GetSpellModOwner()) @@ -2537,7 +2537,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/) if(!targetAura) { - sLog.outError("Target(GUID:" I64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); + sLog.outError("Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); return; } @@ -2745,7 +2745,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) // set the "Crafted by ..." property of the item if( pItem->GetProto()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetProto()->Class != ITEM_CLASS_QUEST) - pItem->SetUInt32Value(ITEM_FIELD_CREATOR,player->GetGUIDLow()); + pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow()); // send info to the client if(pItem) @@ -2769,23 +2769,23 @@ void Spell::EffectCreateItem2(uint32 i) uint32 item_id = m_spellInfo->EffectItemType[i]; if(item_id) - DoCreateItem(i,item_id); + DoCreateItem(i, item_id); // special case: fake item replaced by generate using spell_loot_template if(IsLootCraftingSpell(m_spellInfo)) { if(item_id) { - if(!player->HasItemCount(item_id,1)) + if(!player->HasItemCount(item_id, 1)) return; // remove reagent uint32 count = 1; - player->DestroyItemCount (item_id,count,true); + player->DestroyItemCount(item_id, count, true); } // create some random items - player->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); + player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); } } @@ -3079,7 +3079,7 @@ void Spell::EffectOpenLock(uint32 effIndex) int32 reqSkillValue = 0; int32 skillValue; - SpellCastResult res = CanOpenLock(effIndex,lockId,skillId,reqSkillValue,skillValue); + SpellCastResult res = CanOpenLock(effIndex, lockId, skillId, reqSkillValue, skillValue); if(res != SPELL_CAST_OK) { SendCastResult(res); @@ -3153,7 +3153,7 @@ void Spell::EffectSummonChangeItem(uint32 i) uint8 msg = player->CanStoreItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true ); if( msg == EQUIP_ERR_OK ) { - player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true); + player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt if(m_CastItem==m_targets.getItemTarget()) @@ -3171,7 +3171,7 @@ void Spell::EffectSummonChangeItem(uint32 i) uint8 msg = player->CanBankItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true ); if( msg == EQUIP_ERR_OK ) { - player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true); + player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt if(m_CastItem==m_targets.getItemTarget()) @@ -3189,7 +3189,7 @@ void Spell::EffectSummonChangeItem(uint32 i) uint8 msg = player->CanEquipItem( m_CastItem->GetSlot(), dest, pNewItem, true ); if( msg == EQUIP_ERR_OK ) { - player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true); + player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt if(m_CastItem==m_targets.getItemTarget()) @@ -3219,15 +3219,15 @@ void Spell::EffectProficiency(uint32 /*i*/) Player *p_target = (Player*)unitTarget; uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask; - if(m_spellInfo->EquippedItemClass == 2 && !(p_target->GetWeaponProficiency() & subClassMask)) + if(m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask)) { p_target->AddWeaponProficiency(subClassMask); - p_target->SendProficiency(uint8(0x02),p_target->GetWeaponProficiency()); + p_target->SendProficiency(ITEM_CLASS_WEAPON, p_target->GetWeaponProficiency()); } - if(m_spellInfo->EquippedItemClass == 4 && !(p_target->GetArmorProficiency() & subClassMask)) + if(m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask)) { p_target->AddArmorProficiency(subClassMask); - p_target->SendProficiency(uint8(0x04),p_target->GetArmorProficiency()); + p_target->SendProficiency(ITEM_CLASS_ARMOR, p_target->GetArmorProficiency()); } } @@ -3568,7 +3568,7 @@ void Spell::EffectDistract(uint32 /*i*/) // Set creature Distracted, Stop it, And turn it unitTarget->SetOrientation(angle); unitTarget->StopMoving(); - unitTarget->GetMotionMaster()->MoveDistract(damage*IN_MILISECONDS); + unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILISECONDS); } } @@ -3891,26 +3891,26 @@ void Spell::EffectEnchantItemTmp(uint32 i) uint32 duration; // rogue family enchantments exception by duration - if(m_spellInfo->Id==38615) + if(m_spellInfo->Id == 38615) duration = 1800; // 30 mins // other rogue family enchantments always 1 hour (some have spell damage=0, but some have wrong data in EffBasePoints) - else if(m_spellInfo->SpellFamilyName==SPELLFAMILY_ROGUE) + else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) duration = 3600; // 1 hour // shaman family enchantments - else if(m_spellInfo->SpellFamilyName==SPELLFAMILY_SHAMAN) + else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN) duration = 1800; // 30 mins // other cases with this SpellVisual already selected - else if(m_spellInfo->SpellVisual[0]==215) + else if(m_spellInfo->SpellVisual[0] == 215) duration = 1800; // 30 mins // some fishing pole bonuses - else if(m_spellInfo->SpellVisual[0]==563) + else if(m_spellInfo->SpellVisual[0] == 563) duration = 600; // 10 mins // shaman rockbiter enchantments - else if(m_spellInfo->SpellVisual[0]==0) + else if(m_spellInfo->SpellVisual[0] == 0) duration = 1800; // 30 mins - else if(m_spellInfo->Id==29702) + else if(m_spellInfo->Id == 29702) duration = 300; // 5 mins - else if(m_spellInfo->Id==37360) + else if(m_spellInfo->Id == 37360) duration = 300; // 5 mins // default case else @@ -3924,18 +3924,18 @@ void Spell::EffectEnchantItemTmp(uint32 i) if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)", - p_caster->GetName(),p_caster->GetSession()->GetAccountId(), - itemTarget->GetProto()->Name1,itemTarget->GetEntry(), - item_owner->GetName(),item_owner->GetSession()->GetAccountId()); + p_caster->GetName(), p_caster->GetSession()->GetAccountId(), + itemTarget->GetProto()->Name1, itemTarget->GetEntry(), + item_owner->GetName(), item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped - item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,false); + item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT, false); - itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration*1000, 0); + itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration * 1000, 0); // add new enchanting if equipped - item_owner->ApplyEnchantment(itemTarget,TEMP_ENCHANTMENT_SLOT,true); + item_owner->ApplyEnchantment(itemTarget, TEMP_ENCHANTMENT_SLOT, true); } void Spell::EffectTameCreature(uint32 /*i*/) @@ -4130,7 +4130,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i) // multiple weapon dmg effect workaround // execute only the last weapon damage // and handle all effects at once - for (int j = 0; j < 3; j++) + for (int j = 0; j < 3; ++j) { switch(m_spellInfo->Effect[j]) { @@ -4279,7 +4279,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i) // Stormstrike AP Buff if ( (*citr)->GetMiscValue() == 5634 ) { - m_caster->CastSpell(m_caster,38430,true,NULL,*citr); + m_caster->CastSpell(m_caster, 38430, true, NULL, *citr); break; } } @@ -4306,10 +4306,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: - fixed_bonus += CalculateDamage(j,unitTarget); + fixed_bonus += CalculateDamage(j, unitTarget); break; case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: - fixed_bonus += CalculateDamage(j,unitTarget); + fixed_bonus += CalculateDamage(j, unitTarget); normalized = true; break; case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: @@ -4437,7 +4437,7 @@ void Spell::EffectSummonObjectWild(uint32 i) if( !target ) target = m_caster; - float x,y,z; + float x, y, z; if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; @@ -4445,7 +4445,7 @@ void Spell::EffectSummonObjectWild(uint32 i) z = m_targets.m_destZ; } else - m_caster->GetClosePoint(x,y,z,DEFAULT_WORLD_OBJECT_SIZE); + m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map *map = target->GetMap(); @@ -4549,7 +4549,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; uint32 spell_id = 0; - switch(urand(1,5)) + switch(urand(1, 5)) { case 1: spell_id = 8854; break; default: spell_id = 8855; break; @@ -4671,14 +4671,17 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 29830: { uint32 item = 0; - switch ( urand(1,6) ) + switch ( urand(1, 6) ) { - case 1:case 2:case 3: - item = 23584;break; // Loch Modan Lager - case 4:case 5: - item = 23585;break; // Stouthammer Lite + case 1: + case 2: + case 3: + item = 23584; break; // Loch Modan Lager + case 4: + case 5: + item = 23585; break; // Stouthammer Lite case 6: - item = 23586;break; // Aerie Peak Pale Ale + item = 23586; break; // Aerie Peak Pale Ale } if (item) DoCreateItem(effIndex,item); @@ -4823,7 +4826,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; uint32 spellId = 0; - switch(rand()%4) + switch(rand() % 4) { case 0: spellId = 46740; break; case 1: spellId = 46739; break; @@ -4963,12 +4966,12 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 61288: // Minor Inscription Research case 61756: // Northrend Inscription Research (FAST QA VERSION) { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if(m_caster->GetTypeId() != TYPEID_PLAYER) return; // learn random explicit discovery recipe (if any) if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, (Player*)m_caster)) - ((Player*)m_caster)->learnSpell(discoveredSpell,false); + ((Player*)m_caster)->learnSpell(discoveredSpell, false); return; } } @@ -5006,14 +5009,14 @@ void Spell::EffectScriptEffect(uint32 effIndex) } static uint32 const itypes[8][3] = { - { 5512,19004,19005}, // Minor Healthstone - { 5511,19006,19007}, // Lesser Healthstone - { 5509,19008,19009}, // Healthstone - { 5510,19010,19011}, // Greater Healthstone - { 9421,19012,19013}, // Major Healthstone - {22103,22104,22105}, // Master Healthstone - {36889,36890,36891}, // Demonic Healthstone - {36892,36893,36894} // Fel Healthstone + { 5512, 19004, 19005}, // Minor Healthstone + { 5511, 19006, 19007}, // Lesser Healthstone + { 5509, 19008, 19009}, // Healthstone + { 5510, 19010, 19011}, // Greater Healthstone + { 9421, 19012, 19013}, // Major Healthstone + {22103, 22104, 22105}, // Master Healthstone + {36889, 36890, 36891}, // Demonic Healthstone + {36892, 36893, 36894} // Fel Healthstone }; switch(m_spellInfo->Id) @@ -5254,8 +5257,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) const uint32 spellid = 28703; // don't overwrite an existing aura - for(uint8 i=0; i<5; i++) - if(unitTarget->HasAuraEffect(spellid+i, 0)) + for(uint8 i = 0; i < 5; ++i) + if(unitTarget->HasAuraEffect(spellid + i, 0)) return; unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true); break; @@ -5392,9 +5395,9 @@ void Spell::EffectDuel(uint32 i) //END // Send request - WorldPacket data(SMSG_DUEL_REQUESTED, 16); - data << pGameObj->GetGUID(); - data << caster->GetGUID(); + WorldPacket data(SMSG_DUEL_REQUESTED, 8 + 8); + data << uint64(pGameObj->GetGUID()); + data << uint64(caster->GetGUID()); caster->GetSession()->SendPacket(&data); target->GetSession()->SendPacket(&data); @@ -5413,8 +5416,8 @@ void Spell::EffectDuel(uint32 i) duel2->startTimer = 0; target->duel = duel2; - caster->SetUInt64Value(PLAYER_DUEL_ARBITER,pGameObj->GetGUID()); - target->SetUInt64Value(PLAYER_DUEL_ARBITER,pGameObj->GetGUID()); + caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); + target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); } void Spell::EffectStuck(uint32 /*i*/) @@ -5440,7 +5443,7 @@ void Spell::EffectStuck(uint32 /*i*/) SpellEntry const *spellInfo = sSpellStore.LookupEntry(8690); if(!spellInfo) return; - Spell spell(pTarget,spellInfo,true,0); + Spell spell(pTarget, spellInfo, true, 0); spell.SendSpellCooldown(); } @@ -5453,8 +5456,8 @@ void Spell::EffectSummonPlayer(uint32 /*i*/) if(unitTarget->GetDummyAura(23445)) return; - float x,y,z; - m_caster->GetClosePoint(x,y,z,unitTarget->GetObjectSize()); + float x, y, z; + m_caster->GetClosePoint(x, y, z, unitTarget->GetObjectSize()); ((Player*)unitTarget)->SetSummonPoint(m_caster->GetMapId(),x,y,z); @@ -5559,7 +5562,7 @@ void Spell::EffectEnchantHeldItem(uint32 i) // Apply the temporary enchantment item->SetEnchantment(slot, enchant_id, duration*IN_MILISECONDS, 0); - item_owner->ApplyEnchantment(item,slot,true); + item_owner->ApplyEnchantment(item, slot, true); } } @@ -5591,7 +5594,7 @@ void Spell::EffectInebriate(uint32 /*i*/) currentDrunk = 0xFFFF; else currentDrunk += drunkMod; - player->SetDrunkValue(currentDrunk, m_CastItem?m_CastItem->GetEntry():0); + player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0); } void Spell::EffectFeedPet(uint32 i) @@ -5620,7 +5623,7 @@ void Spell::EffectFeedPet(uint32 i) _player->DestroyItemCount(foodItem,count,true); // TODO: fix crash when a spell has two effects, both pointed at the same item target - m_caster->CastCustomSpell(pet,m_spellInfo->EffectTriggerSpell[i],&benefit,NULL,NULL,true); + m_caster->CastCustomSpell(pet, m_spellInfo->EffectTriggerSpell[i], &benefit, NULL, NULL, true); } void Spell::EffectDismissPet(uint32 /*i*/) @@ -5634,7 +5637,7 @@ void Spell::EffectDismissPet(uint32 /*i*/) if(!pet||!pet->isAlive()) return; - ((Player*)m_caster)->RemovePet(pet,PET_SAVE_NOT_IN_SLOT); + ((Player*)m_caster)->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); } void Spell::EffectSummonObject(uint32 i) @@ -5664,7 +5667,7 @@ void Spell::EffectSummonObject(uint32 i) GameObject* pGameObj = new GameObject; - float x,y,z; + float x, y, z; // If dest location if present if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { @@ -5674,7 +5677,7 @@ void Spell::EffectSummonObject(uint32 i) } // Summon in random point all other units if location present else - m_caster->GetClosePoint(x,y,z,DEFAULT_WORLD_OBJECT_SIZE); + m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map *map = m_caster->GetMap(); if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, @@ -5692,8 +5695,8 @@ void Spell::EffectSummonObject(uint32 i) map->Add(pGameObj); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); - data << pGameObj->GetGUID(); - m_caster->SendMessageToSet(&data,true); + data << uint64(pGameObj->GetGUID()); + m_caster->SendMessageToSet(&data, true); m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID(); } @@ -5848,7 +5851,7 @@ void Spell::EffectReputation(uint32 i) if(!factionEntry) return; - _player->GetReputationMgr().ModifyReputation(factionEntry,rep_change); + _player->GetReputationMgr().ModifyReputation(factionEntry, rep_change); } void Spell::EffectQuestComplete(uint32 i) @@ -6001,7 +6004,7 @@ void Spell::EffectPlayerPull(uint32 i) float vsin = sin(unitTarget->GetAngle(m_caster)); float vcos = cos(unitTarget->GetAngle(m_caster)); - WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4)); + WorldPacket data(SMSG_MOVE_KNOCK_BACK, 8+4+4+4+4+4); data.append(unitTarget->GetPackGUID()); data << uint32(0); // Sequence data << float(vcos); // x direction @@ -6099,7 +6102,7 @@ void Spell::EffectDurabilityDamage(uint32 i) // Possibly its mean -1 all player equipped items and -2 all items if(slot < 0) { - ((Player*)unitTarget)->DurabilityPointsLossAll(damage,(slot < -1)); + ((Player*)unitTarget)->DurabilityPointsLossAll(damage, (slot < -1)); return; } @@ -6107,8 +6110,8 @@ void Spell::EffectDurabilityDamage(uint32 i) if(slot >= INVENTORY_SLOT_BAG_END) return; - if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0,slot)) - ((Player*)unitTarget)->DurabilityPointsLoss(item,damage); + if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + ((Player*)unitTarget)->DurabilityPointsLoss(item, damage); } void Spell::EffectDurabilityDamagePCT(uint32 i) @@ -6122,7 +6125,7 @@ void Spell::EffectDurabilityDamagePCT(uint32 i) // Possibly its mean -1 all player equipped items and -2 all items if(slot < 0) { - ((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f,(slot < -1)); + ((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f, (slot < -1)); return; } @@ -6133,8 +6136,8 @@ void Spell::EffectDurabilityDamagePCT(uint32 i) if(damage <= 0) return; - if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0,slot)) - ((Player*)unitTarget)->DurabilityLoss(item,double(damage)/100.0f); + if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + ((Player*)unitTarget)->DurabilityLoss(item, double(damage)/100.0f); } void Spell::EffectModifyThreatPercent(uint32 /*effIndex*/) @@ -6157,7 +6160,7 @@ void Spell::EffectTransmitted(uint32 effIndex) return; } - float fx,fy,fz; + float fx, fy, fz; if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { @@ -6169,7 +6172,7 @@ void Spell::EffectTransmitted(uint32 effIndex) else if(m_spellInfo->EffectRadiusIndex[effIndex] && m_spellInfo->speed==0) { float dis = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex])); - m_caster->GetClosePoint(fx,fy,fz,DEFAULT_WORLD_OBJECT_SIZE, dis); + m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } else { @@ -6178,14 +6181,14 @@ void Spell::EffectTransmitted(uint32 effIndex) float max_dis = GetSpellMaxRangeForFriend(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float dis = rand_norm() * (max_dis - min_dis) + min_dis; - m_caster->GetClosePoint(fx,fy,fz,DEFAULT_WORLD_OBJECT_SIZE, dis); + m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } Map *cMap = m_caster->GetMap(); if(goinfo->type==GAMEOBJECT_TYPE_FISHINGNODE) { - if ( !cMap->IsInWater(fx,fy,fz-0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole + if ( !cMap->IsInWater(fx, fy, fz-0.5f)) // Hack to prevent fishing bobber from failing to land on fishing hole { // but this is not proper, we really need to ignore not materialized objects SendCastResult(SPELL_FAILED_NOT_HERE); SendChannelUpdate(0); @@ -6193,12 +6196,12 @@ void Spell::EffectTransmitted(uint32 effIndex) } // replace by water level in this case - fz = cMap->GetWaterLevel(fx,fy); + fz = cMap->GetWaterLevel(fx, fy); } // if gameobject is summoning object, it should be spawned right on caster's position else if(goinfo->type==GAMEOBJECT_TYPE_SUMMONING_RITUAL) { - m_caster->GetPosition(fx,fy,fz); + m_caster->GetPosition(fx, fy, fz); } GameObject* pGameObj = new GameObject; @@ -6235,7 +6238,7 @@ void Spell::EffectTransmitted(uint32 effIndex) } case GAMEOBJECT_TYPE_SUMMONING_RITUAL: { - if(m_caster->GetTypeId()==TYPEID_PLAYER) + if(m_caster->GetTypeId() == TYPEID_PLAYER) { pGameObj->AddUniqueUse((Player*)m_caster); m_caster->AddGameObject(pGameObj); // will removed at spell cancel diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index ca675dcd931..7e72fd4e749 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -445,7 +445,7 @@ void WorldSession::HandleCancelChanneling( WorldPacket & /*recv_data */) */ } -void WorldSession::HandleTotemDestroy( WorldPacket& recvPacket) +void WorldSession::HandleTotemDestroyed( WorldPacket& recvPacket) { CHECK_PACKET_SIZE(recvPacket, 1); diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 5dd2010b83b..6fb3d8cfc55 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -620,11 +620,13 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative) case SPELL_AURA_MOD_HEALING_DONE: case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: - { if(spellproto->CalculateSimpleValue(effIndex) < 0) return false; break; - } + case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: + if(spellproto->CalculateSimpleValue(effIndex) > 0) + return true; // some expected possitive spells have SPELL_ATTR_EX_NEGATIVE + break; case SPELL_AURA_ADD_TARGET_TRIGGER: return true; case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index fe1255e51a1..7d90bbd26ce 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -157,7 +157,7 @@ bool WorldSession::SendLearnNewTaxiNode( Creature* unit ) return false; } -void WorldSession::HandleActivateTaxiFarOpcode ( WorldPacket & recv_data ) +void WorldSession::HandleActivateTaxiExpressOpcode ( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+4+4); @@ -171,7 +171,7 @@ void WorldSession::HandleActivateTaxiFarOpcode ( WorldPacket & recv_data ) Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { - sLog.outDebug( "WORLD: HandleActivateTaxiFarOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug( "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) ); return; } // recheck @@ -194,7 +194,7 @@ void WorldSession::HandleActivateTaxiFarOpcode ( WorldPacket & recv_data ) GetPlayer()->ActivateTaxiPathTo(nodes, npc); } -void WorldSession::HandleTaxiNextDestinationOpcode(WorldPacket& /*recv_data*/) +void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& /*recv_data*/) { sLog.outDebug( "WORLD: Received CMSG_MOVE_SPLINE_DONE" ); diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index c0006ba2d52..bd698932e6c 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -567,7 +567,7 @@ void Transport::UpdateForMap(Map const* targetMap) UpdateData transData; BuildCreateUpdateBlockForPlayer(&transData, itr->getSource()); WorldPacket packet; - transData.BuildPacket(&packet, true); + transData.BuildPacket(&packet); itr->getSource()->SendDirectMessage(&packet); } } @@ -577,7 +577,7 @@ void Transport::UpdateForMap(Map const* targetMap) UpdateData transData; BuildOutOfRangeUpdateBlock(&transData); WorldPacket out_packet; - transData.BuildPacket(&out_packet, true); + transData.BuildPacket(&out_packet); for(Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) if(this != itr->getSource()->GetTransport()) diff --git a/src/game/Transports.h b/src/game/Transports.h index 2df39f401e7..d72fa3b2124 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -72,6 +72,7 @@ class Transport : protected GameObject using GameObject::GetPositionZ; using GameObject::BuildCreateUpdateBlockForPlayer; using GameObject::BuildOutOfRangeUpdateBlock; + using GameObject::GetPackGUID; bool Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags); bool GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index cd199ee76d2..cff6e0ac853 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -376,6 +376,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 M } data << uint32(MovementFlags); + data << uint32(Time); // Time in between points data << uint32(1); // 1 single waypoint data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B @@ -390,14 +391,14 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end) { uint32 traveltime = uint32(path.GetTotalLength(start, end) * 32); - uint32 pathSize = end-start; + uint32 pathSize = end - start; WorldPacket data( SMSG_MONSTER_MOVE, (GetPackGUID().size()+4+4+4+4+1+4+4+4+pathSize*4*3) ); data.append(GetPackGUID()); data << GetPositionX(); data << GetPositionY(); data << GetPositionZ(); - data << getMSTime(); + data << uint32(getMSTime()); data << uint8( 0 ); data << uint32(((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) || isInFlight())? (MOVEFLAG_FLY|MOVEFLAG_WALK) : MOVEFLAG_WALK); data << uint32( traveltime ); @@ -1370,7 +1371,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) { const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId()); - if(area && area->flags & 0x800) //sanctuary + if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary return; } @@ -1606,11 +1607,11 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER) { const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId()); - if(area && area->flags & 0x800) //sanctuary + if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary return; } - // Hmmmm dont like this emotes cloent must by self do all animations + // Hmmmm dont like this emotes client must by self do all animations if (damageInfo->HitInfo&HITINFO_CRITICALHIT) pVictim->HandleEmoteCommand(EMOTE_ONESHOT_WOUNDCRITICAL); if(damageInfo->blocked_amount && damageInfo->TargetState!=VICTIMSTATE_BLOCKS) @@ -1759,7 +1760,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) void Unit::HandleEmoteCommand(uint32 anim_id) { - WorldPacket data( SMSG_EMOTE, 12 ); + WorldPacket data( SMSG_EMOTE, 4 + 8 ); data << uint32(anim_id); data << uint64(GetGUID()); SendMessageToSet(&data, true); @@ -2640,9 +2641,9 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const return (100.0f - LvlPenalty) * LvlFactor / 100.0f; } -void Unit::SendAttackStart(Unit* pVictim) +void Unit::SendMeleeAttackStart(Unit* pVictim) { - WorldPacket data( SMSG_ATTACKSTART, 16 ); + WorldPacket data( SMSG_ATTACKSTART, 8 + 8 ); data << uint64(GetGUID()); data << uint64(pVictim->GetGUID()); @@ -2650,7 +2651,7 @@ void Unit::SendAttackStart(Unit* pVictim) DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" ); } -void Unit::SendAttackStop(Unit* victim) +void Unit::SendMeleeAttackStop(Unit* victim) { if(!victim) return; @@ -4507,7 +4508,7 @@ void Unit::RemoveAllGameObjects() void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log) { - WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+1+4+4+1+1+4+4+1)); // we guess size + WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size data.append(log->target->GetPackGUID()); data.append(log->attacker->GetPackGUID()); data << uint32(log->SpellID); @@ -4525,10 +4526,10 @@ void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log) SendMessageToSet( &data, true ); } -void Unit::SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit) +void Unit::SendSpellNonMeleeDamageLog(Unit *target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit) { - SpellNonMeleeDamage log(this,target,SpellID,damageSchoolMask); - log.damage = Damage-AbsorbedDamage-Resist-Blocked; + SpellNonMeleeDamage log(this, target, SpellID, damageSchoolMask); + log.damage = Damage - AbsorbedDamage - Resist - Blocked; log.absorb = AbsorbedDamage; log.resist = Resist; log.physicalLog = PhysicalDamage; @@ -4550,6 +4551,51 @@ void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVic pVictim->ProcDamageAndSpellFor(true,this,procVictim, procExtra, attType, procSpell, amount, procAura); } +void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo) +{ + AuraEffect *aura = pInfo->auraEff; + + WorldPacket data(SMSG_PERIODICAURALOG, 30); + data.append(GetPackGUID()); + data.appendPackGUID(aura->GetCasterGUID()); + data << uint32(aura->GetId()); // spellId + data << uint32(1); // count + data << uint32(aura->GetAuraName()); // auraId + switch(aura->GetAuraName()) + { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: + data << uint32(pInfo->damage); // damage + data << uint32(pInfo->overDamage); // overkill? + data << uint32(GetSpellSchoolMask(aura->GetSpellProto())); + data << uint32(pInfo->absorb); // absorb + data << uint32(pInfo->resist); // resist + data << uint8(0); // new 3.1.2 + break; + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_OBS_MOD_HEALTH: + data << uint32(pInfo->damage); // damage + data << uint32(pInfo->overDamage); // overheal? + data << uint8(0); // new 3.1.2 + break; + case SPELL_AURA_OBS_MOD_ENERGY: + case SPELL_AURA_PERIODIC_ENERGIZE: + data << uint32(aura->GetMiscValue()); // power type + data << uint32(pInfo->damage); // damage + break; + case SPELL_AURA_PERIODIC_MANA_LEECH: + data << uint32(aura->GetMiscValue()); // power type + data << uint32(pInfo->damage); // amount + data << float(pInfo->multiplier); // gain multiplier + break; + default: + sLog.outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraName())); + return; + } + + SendMessageToSet(&data, true); +} + void Unit::SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo) { WorldPacket data(SMSG_SPELLLOGMISS, (4+8+1+4+8+1)); @@ -4566,41 +4612,43 @@ void Unit::SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo) void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) { + sLog.outDebug("WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); + uint32 count = 1; - WorldPacket data(SMSG_ATTACKERSTATEUPDATE, (16+45)); // we guess size - data << (uint32)damageInfo->HitInfo; - data.append(GetPackGUID()); + WorldPacket data(SMSG_ATTACKERSTATEUPDATE, 16 + 45); // we guess size + data << uint32(damageInfo->HitInfo); + data.append(damageInfo->attacker->GetPackGUID()); data.append(damageInfo->target->GetPackGUID()); - data << (uint32)(damageInfo->damage); // Full damage - data << uint32(int32 (damageInfo->target->GetHealth()-damageInfo->damage ) >0 ? 0 : damageInfo->damage - damageInfo->target->GetHealth()); // Overkill - - data << (uint8)count; // Sub damage count + data << uint32(damageInfo->damage); // Full damage + int32 overkill = damageInfo->damage - damageInfo->target->GetHealth(); + data << uint32(overkill < 0 ? 0 : overkill); // Overkill + data << uint8(count); // Sub damage count for(int i = 0; i < count; ++i) { - data << (uint32)(damageInfo->damageSchoolMask); // School of sub damage - data << (float)damageInfo->damage; // sub damage - data << (uint32)damageInfo->damage; // Sub Damage + data << uint32(damageInfo->damageSchoolMask); // School of sub damage + data << float(damageInfo->damage); // sub damage + data << uint32(damageInfo->damage); // Sub Damage } if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) { for(int i = 0; i < count; ++i) - data << (uint32)damageInfo->absorb; // Absorb + data << uint32(damageInfo->absorb); // Absorb } if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) { for(int i = 0; i < count; ++i) - data << (uint32)damageInfo->resist; // Resist + data << uint32(damageInfo->resist); // Resist } - data << (uint8)damageInfo->TargetState; - data << (uint32)0; - data << (uint32)0; + data << uint8(damageInfo->TargetState); + data << uint32(0); + data << uint32(0); if(damageInfo->HitInfo & HITINFO_BLOCK) - data << (uint32)damageInfo->blocked_amount; + data << uint32(damageInfo->blocked_amount); if(damageInfo->HitInfo & HITINFO_UNK3) data << uint32(0); @@ -4629,72 +4677,17 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount) { - sLog.outDebug("WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); - - WorldPacket data(SMSG_ATTACKERSTATEUPDATE, (16+45)); // we guess size - data << uint32(HitInfo); // flags - data.append(GetPackGUID()); - data.append(target->GetPackGUID()); - int32 damageDone = Damage-AbsorbDamage-Resist-BlockedAmount; - data << uint32(damageDone);// damage - data << uint32(int32 (target->GetHealth()-damageDone ) >0 ? 0 : damageDone - target->GetHealth()); // Overkill - - data << (uint8)SwingType; // count? - - // for(i = 0; i < SwingType; ++i) - data << (uint32)damageSchoolMask; - data << (float)(damageDone); - data << (uint32)(damageDone); - // end loop - - if(HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) - { - // for(i = 0; i < SwingType; ++i) - data << uint32(AbsorbDamage); - // end loop - } - - if(HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) - { - // for(i = 0; i < SwingType; ++i) - data << uint32(Resist); - // end loop - } - - data << (uint8)TargetState; - data << (uint32)0; - data << (uint32)0; - - if(HitInfo & HITINFO_BLOCK) - { - data << uint32(BlockedAmount); - } - - if(HitInfo & HITINFO_UNK3) - { - data << uint32(0); - } - - if(HitInfo & HITINFO_UNK1) - { - data << uint32(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - data << float(0); - for(uint8 i = 0; i < 5; ++i) - { - data << float(0); - data << float(0); - } - data << uint32(0); - } - - SendMessageToSet( &data, true ); + CalcDamageInfo dmgInfo; + dmgInfo.HitInfo = HitInfo; + dmgInfo.attacker = this; + dmgInfo.target = target; + dmgInfo.damage = Damage - AbsorbDamage - Resist - BlockedAmount; + dmgInfo.damageSchoolMask = damageSchoolMask; + dmgInfo.absorb = AbsorbDamage; + dmgInfo.resist = Resist; + dmgInfo.TargetState = TargetState; + dmgInfo.blocked_amount = BlockedAmount; + SendAttackStateUpdate(&dmgInfo); } bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown) @@ -7370,7 +7363,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) return false; - // Costum requirements (not listed in procEx) Warning! damage dealing after this + // Custom requirements (not listed in procEx) Warning! damage dealing after this // Custom triggered spells switch (auraSpellInfo->Id) { @@ -7404,7 +7397,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Greater Heal Refund (Avatar Raiment set) case 37594: { - // Not give if target alredy have full health + // Not give if target already have full health if (pVictim->GetHealth() == pVictim->GetMaxHealth()) return false; // If your Greater Heal brings the target to full health, you gain $37595s1 mana. @@ -7439,7 +7432,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig } } - // Costum basepoints/target for exist spell + // Custom basepoints/target for exist spell // dummy basepoints or other customs switch(trigger_spell_id) { @@ -7452,7 +7445,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig target = pVictim; break; } - // Combo points add triggers (need add combopoint only for main tatget, and after possible combopoints reset) + // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset) case 15250: // Rogue Setup { if(!pVictim || pVictim != getVictim()) // applied only for main target @@ -8032,7 +8025,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) if( meleeAttack && !hasUnitState(UNIT_STAT_MELEE_ATTACKING) ) { addUnitState(UNIT_STAT_MELEE_ATTACKING); - SendAttackStart(victim); + SendMeleeAttackStart(victim); return true; } return false; @@ -8081,7 +8074,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) resetAttackTimer(OFF_ATTACK); if(meleeAttack) - SendAttackStart(victim); + SendMeleeAttackStart(victim); return true; } @@ -8110,7 +8103,7 @@ bool Unit::AttackStop() ((Creature*)this)->SetNoSearchAssistance(false); } - SendAttackStop(victim); + SendMeleeAttackStop(victim); return true; } @@ -9285,7 +9278,6 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama break; } - if(pVictim) { uint32 creatureTypeMask = pVictim->GetCreatureTypeMask(); @@ -10625,7 +10617,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) void Unit::SetHover(bool on) { if(on) - CastSpell(this,11010,true); + CastSpell(this, 11010, true); else RemoveAurasDueToSpell(11010); } @@ -11832,7 +11824,7 @@ bool CharmInfo::AddSpellToActionBar(uint32 spell_id, ActiveStates newstate) } } - // or use empty slot in other case + // or use empty slot in other case for(uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) { if (!PetActionBar[i].SpellOrAction && PetActionBar[i].IsActionBarForSpell()) @@ -12344,7 +12336,7 @@ void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_PET_CAST_FAILED, (4+1)); + WorldPacket data(SMSG_PET_CAST_FAILED, 1 + 4 + 1); data << uint8(0); // cast count? data << uint32(spellid); data << uint8(msg); @@ -12370,7 +12362,7 @@ void Unit::SendPetTalk (uint32 pettalk) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_PET_ACTION_SOUND, 8+4); + WorldPacket data(SMSG_PET_ACTION_SOUND, 8 + 4); data << uint64(GetGUID()); data << uint32(pettalk); ((Player*)owner)->GetSession()->SendPacket(&data); @@ -12397,7 +12389,7 @@ void Unit::SendPetClearCooldown (uint32 spellid) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_CLEAR_COOLDOWN, (4+8)); + WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8); data << uint32(spellid); data << uint64(GetGUID()); ((Player*)owner)->GetSession()->SendPacket(&data); @@ -12409,8 +12401,9 @@ void Unit::SendPetAIReaction(uint64 guid) if(!owner || owner->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data(SMSG_AI_REACTION, 12); - data << uint64(guid) << uint32(00000002); + WorldPacket data(SMSG_AI_REACTION, 8 + 4); + data << uint64(guid); + data << uint32(AI_REACTION_AGGRO); ((Player*)owner)->GetSession()->SendPacket(&data); } @@ -13385,7 +13378,8 @@ void Unit::SetStunned(bool apply) // Creature specific if(GetTypeId() != TYPEID_PLAYER) ((Creature*)this)->StopMoving(); - //else + else + SetStandState(UNIT_STAND_STATE_STAND); // SetUnitMovementFlags(0); //Clear movement flags WorldPacket data(SMSG_FORCE_MOVE_ROOT, 8); @@ -13649,7 +13643,7 @@ void Unit::RemoveCharmedOrPossessedBy(Unit *charmer) if(GetCharmInfo()) GetCharmInfo()->SetPetNumber(0, true); else - sLog.outError("Aura::HandleModCharm: target="I64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); + sLog.outError("Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); } } diff --git a/src/game/Unit.h b/src/game/Unit.h index 399d0667e3e..375e21e5f4d 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -638,8 +638,8 @@ enum MovementFlags MOVEMENTFLAG_RIGHT = 0x00000020, MOVEMENTFLAG_PITCH_UP = 0x00000040, MOVEMENTFLAG_PITCH_DOWN = 0x00000080, - MOVEMENTFLAG_WALK_MODE = 0x00000100, - MOVEMENTFLAG_ONTRANSPORT = 0x00000200, + MOVEMENTFLAG_WALK_MODE = 0x00000100, // Walking + MOVEMENTFLAG_ONTRANSPORT = 0x00000200, // Used for flying on some creatures MOVEMENTFLAG_LEVITATING = 0x00000400, MOVEMENTFLAG_FLY_UNK1 = 0x00000800, MOVEMENTFLAG_JUMPING = 0x00001000, @@ -658,6 +658,42 @@ enum MovementFlags MOVEMENTFLAG_UNK3 = 0x40000000 }; +enum MonsterMovementFlags +{ + MONSTER_MOVE_NONE = 0x00000000, + MONSTER_MOVE_FORWARD = 0x00000001, + MONSTER_MOVE_BACKWARD = 0x00000002, + MONSTER_MOVE_STRAFE_LEFT = 0x00000004, + MONSTER_MOVE_STRAFE_RIGHT = 0x00000008, + MONSTER_MOVE_LEFT = 0x00000010, // turn + MONSTER_MOVE_RIGHT = 0x00000020, // turn + MONSTER_MOVE_PITCH_UP = 0x00000040, + MONSTER_MOVE_PITCH_DOWN = 0x00000080, + MONSTER_MOVE_TELEPORT = 0x00000100, + MONSTER_MOVE_TELEPORT2 = 0x00000200, + MONSTER_MOVE_LEVITATING = 0x00000400, + MONSTER_MOVE_UNK1 = 0x00000800, // float+uint32 + MONSTER_MOVE_WALK = 0x00001000, // run2? + MONSTER_MOVE_SPLINE = 0x00002000, // spline n*(float x,y,z) + // 0x4000, 0x8000, 0x10000, 0x20000 run + MONSTER_MOVE_SPLINE2 = 0x00040000, // spline n*(float x,y,z) + MONSTER_MOVE_UNK2 = 0x00080000, // used for flying mobs + MONSTER_MOVE_UNK3 = 0x00100000, // used for flying mobs + MONSTER_MOVE_UNK4 = 0x00200000, // uint8+uint32 + MONSTER_MOVE_UNK5 = 0x00400000, // run in place, then teleport to final point + MONSTER_MOVE_UNK6 = 0x00800000, // teleport + MONSTER_MOVE_UNK7 = 0x01000000, // run + MONSTER_MOVE_FLY = 0x02000000, // swimming/flying (depends on mob?) + MONSTER_MOVE_UNK9 = 0x04000000, // run + MONSTER_MOVE_UNK10 = 0x08000000, // run + MONSTER_MOVE_UNK11 = 0x10000000, // run + MONSTER_MOVE_UNK12 = 0x20000000, // run + MONSTER_MOVE_UNK13 = 0x40000000, // levitating + + // masks + MONSTER_MOVE_SPLINE_FLY = 0x00003000, // fly by points +}; + struct MovementInfo { // common @@ -743,7 +779,7 @@ struct CalcDamageInfo uint32 procAttacker; uint32 procVictim; uint32 procEx; - uint32 cleanDamage; // Used only fo rage calcultion + uint32 cleanDamage; // Used only for rage calculation MeleeHitOutcome hitOutCome; // TODO: remove this field (need use TargetState) }; @@ -770,6 +806,19 @@ struct SpellNonMeleeDamage{ uint32 cleanDamage; }; +struct SpellPeriodicAuraLogInfo +{ + SpellPeriodicAuraLogInfo(AuraEffect *_auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier) + : auraEff(_auraEff), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier) {} + + AuraEffect *auraEff; + uint32 damage; + uint32 absorb; + uint32 resist; + uint32 overDamage; // overkill/overheal + float multiplier; +}; + uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition); #define MAX_DECLINED_NAME_CASES 5 @@ -989,6 +1038,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void CombatStopWithPets(bool includingCast = false); Unit* SelectNearbyTarget(float dist = NOMINAL_MELEE_RANGE) const; bool hasNegativeAuraWithInterruptFlag(uint32 flag); + void SendMeleeAttackStop(Unit* victim); + void SendMeleeAttackStart(Unit* pVictim); void addUnitState(uint32 f) { m_state |= f; } bool hasUnitState(const uint32 f) const { return (m_state & f); } @@ -1212,11 +1263,11 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void DeMorph(); - void SendAttackStart(Unit* pVictim); void SendAttackStateUpdate(CalcDamageInfo *damageInfo); void SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log); - void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, SpellSchoolMask damageSchoolMask,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false); + void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false); + void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo); void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo); void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false); @@ -1743,9 +1794,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject ThreatManager m_ThreatManager; private: - void SendAttackStop(Unit* victim); // only from AttackStop(Unit*) - //void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*) - bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const * procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent ); bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); bool HandleObsModEnergyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp index b9c1ec04c63..34547040cda 100644 --- a/src/game/UpdateData.cpp +++ b/src/game/UpdateData.cpp @@ -103,24 +103,20 @@ void UpdateData::Compress(void* dst, uint32 *dst_size, void* src, int src_size) *dst_size = c_stream.total_out; } -bool UpdateData::BuildPacket(WorldPacket *packet, bool /*hasTransport*/) +bool UpdateData::BuildPacket(WorldPacket *packet) { - ByteBuffer buf(m_data.size() + 10 + m_outOfRangeGUIDs.size()*8); + ByteBuffer buf(m_data.size()); buf << (uint32) (!m_outOfRangeGUIDs.empty() ? m_blockCount + 1 : m_blockCount); - //buf << (uint8) (hasTransport ? 1 : 0); if(!m_outOfRangeGUIDs.empty()) { buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS; buf << (uint32) m_outOfRangeGUIDs.size(); - for(std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); - i != m_outOfRangeGUIDs.end(); ++i) + for(std::set<uint64>::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i) { - //buf.appendPackGUID(*i); - buf << (uint8)0xFF; - buf << (uint64) *i; + buf.appendPackGUID(*i); } } @@ -128,24 +124,23 @@ bool UpdateData::BuildPacket(WorldPacket *packet, bool /*hasTransport*/) packet->clear(); - if (m_data.size() > 50 ) + size_t pSize = buf.size(); + + if (pSize > 100 ) // compress large packets { - uint32 destsize = buf.size() + buf.size()/10 + 16; - packet->resize( destsize ); + packet->resize(pSize); - packet->put(0, (uint32)buf.size()); + packet->put<uint32>(0, pSize); - Compress(const_cast<uint8*>(packet->contents()) + sizeof(uint32), - &destsize, - (void*)buf.contents(), - buf.size()); + uint32 destsize = pSize; + Compress(const_cast<uint8*>(packet->contents()) + sizeof(uint32), &destsize, (void*)buf.contents(), pSize); if (destsize == 0) return false; packet->resize( destsize + sizeof(uint32) ); packet->SetOpcode( SMSG_COMPRESSED_UPDATE_OBJECT ); } - else + else // send small packets without compression { packet->append( buf ); packet->SetOpcode( SMSG_UPDATE_OBJECT ); diff --git a/src/game/UpdateData.h b/src/game/UpdateData.h index 71a9258b90b..c563911ba74 100644 --- a/src/game/UpdateData.h +++ b/src/game/UpdateData.h @@ -35,15 +35,17 @@ enum OBJECT_UPDATE_TYPE enum OBJECT_UPDATE_FLAGS { - UPDATEFLAG_NONE = 0x00, - UPDATEFLAG_SELF = 0x01, - UPDATEFLAG_TRANSPORT = 0x02, - UPDATEFLAG_HAS_TARGET = 0x04, - UPDATEFLAG_LOWGUID = 0x08, - UPDATEFLAG_HIGHGUID = 0x10, - UPDATEFLAG_LIVING = 0x20, - UPDATEFLAG_HAS_POSITION = 0x40, - UPDATEFLAG_VEHICLE = 0x80 + UPDATEFLAG_NONE = 0x0000, + UPDATEFLAG_SELF = 0x0001, + UPDATEFLAG_TRANSPORT = 0x0002, + UPDATEFLAG_HAS_TARGET = 0x0004, + UPDATEFLAG_LOWGUID = 0x0008, + UPDATEFLAG_HIGHGUID = 0x0010, + UPDATEFLAG_LIVING = 0x0020, + UPDATEFLAG_HAS_POSITION = 0x0040, + UPDATEFLAG_VEHICLE = 0x0080, + UPDATEFLAG_POSITION = 0x0100, + UPDATEFLAG_ROTATION = 0x0200 }; class UpdateData @@ -54,7 +56,7 @@ class UpdateData void AddOutOfRangeGUID(std::set<uint64>& guids); void AddOutOfRangeGUID(const uint64 &guid); void AddUpdateBlock(const ByteBuffer &block); - bool BuildPacket(WorldPacket *packet, bool hasTransport = false); + bool BuildPacket(WorldPacket *packet); bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); } void Clear(); diff --git a/src/game/VoiceChatHandler.cpp b/src/game/VoiceChatHandler.cpp index 8e787549e33..0aef129a010 100644 --- a/src/game/VoiceChatHandler.cpp +++ b/src/game/VoiceChatHandler.cpp @@ -24,23 +24,23 @@ #include "Opcodes.h" #include "Log.h" -void WorldSession::HandleVoiceSettingsOpcode( WorldPacket & recv_data ) +void WorldSession::HandleVoiceSessionEnableOpcode( WorldPacket & recv_data ) { - sLog.outDebug("WORLD: CMSG_VOICE_SETTINGS"); + sLog.outDebug("WORLD: CMSG_VOICE_SESSION_ENABLE"); // uint8 isVoiceEnabled, uint8 isMicrophoneEnabled recv_data.hexlike(); } -void WorldSession::HandleChannelEnableVoiceOpcode( WorldPacket & recv_data ) +void WorldSession::HandleChannelVoiceOnOpcode( WorldPacket & recv_data ) { - sLog.outDebug("WORLD: CMSG_CHANNEL_ENABLE_VOICE"); + sLog.outDebug("WORLD: CMSG_CHANNEL_VOICE_ON"); // Enable Voice button in channel context menu recv_data.hexlike(); } -void WorldSession::HandleChannelVoiceChatQuery( WorldPacket & recv_data ) +void WorldSession::HandleSetActiveVoiceChannel( WorldPacket & recv_data ) { - sLog.outDebug("WORLD: CMSG_CHANNEL_VOICE_CHAT_QUERY"); + sLog.outDebug("WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); // uint32, string recv_data.hexlike(); } diff --git a/src/game/World.cpp b/src/game/World.cpp index 563ee500d5f..e180e38b4db 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1491,7 +1491,7 @@ void World::SetInitialWorldSettings() sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d", local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); - LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " I64FMTD ", '%s', 0)", + LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " UI64FMTD ", '%s', 0)", realmID, uint64(m_startTime), isoDate); m_timers[WUPDATE_OBJECTS].SetInterval(0); @@ -1730,7 +1730,7 @@ void World::Update(uint32 diff) uint32 maxClientsNum = GetMaxActiveSessionCount(); m_timers[WUPDATE_UPTIME].Reset(); - LoginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " I64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime)); + LoginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " UI64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime)); } /// <li> Clean logs table @@ -1742,7 +1742,7 @@ void World::Update(uint32 diff) uint32 maxClientsNum = sWorld.GetMaxActiveSessionCount(); m_timers[WUPDATE_CLEANDB].Reset(); - LoginDatabase.PExecute("DELETE FROM logs WHERE (time + %u) < "I64FMTD";", + LoginDatabase.PExecute("DELETE FROM logs WHERE (time + %u) < "UI64FMTD";", sWorld.getConfig(CONFIG_LOGDB_CLEARTIME), uint64(time(0))); } } diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 36342c8dee1..1721e3ff295 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -122,8 +122,8 @@ void WorldSession::SendPacket(WorldPacket const* packet) { uint64 minTime = uint64(cur_time - lastTime); uint64 fullTime = uint64(lastTime - firstTime); - sLog.outDetail("Send all time packets count: " I64FMTD " bytes: " I64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u",sendPacketCount,sendPacketBytes,float(sendPacketCount)/fullTime,float(sendPacketBytes)/fullTime,uint32(fullTime)); - sLog.outDetail("Send last min packets count: " I64FMTD " bytes: " I64FMTD " avr.count/sec: %f avr.bytes/sec: %f",sendLastPacketCount,sendLastPacketBytes,float(sendLastPacketCount)/minTime,float(sendLastPacketBytes)/minTime); + sLog.outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u",sendPacketCount,sendPacketBytes,float(sendPacketCount)/fullTime,float(sendPacketBytes)/fullTime,uint32(fullTime)); + sLog.outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f",sendLastPacketCount,sendLastPacketBytes,float(sendLastPacketCount)/minTime,float(sendLastPacketBytes)/minTime); lastTime = cur_time; sendLastPacketCount = 1; @@ -188,7 +188,7 @@ bool WorldSession::Update(uint32 /*diff*/) (this->*opHandle.handler)(*packet); // lag can cause STATUS_LOGGEDIN opcodes to arrive after the player started a transfer break; - case STATUS_TRANSFER_PENDING: + case STATUS_TRANSFER: if(!_player) logUnexpectedOpcode(packet, "the player has not logged in yet"); else if(_player->IsInWorld()) @@ -350,12 +350,12 @@ void WorldSession::LogoutPlayer(bool Save) if(Save) { uint32 eslot; - for(int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; j++) + for(int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j) { eslot = j - BUYBACK_SLOT_START; - _player->SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1+eslot*2,0); - _player->SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1+eslot,0); - _player->SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1+eslot,0); + _player->SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), 0); + _player->SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0); + _player->SetUInt32Value(PLAYER_FIELD_BUYBACK_TIMESTAMP_1 + eslot, 0); } _player->SaveToDB(); } diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 346afd99edc..53f2a4b52f6 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -282,8 +282,8 @@ class TRINITY_DLL_SPEC WorldSession void HandleMountSpecialAnimOpcode(WorldPacket &recvdata); // character view - void HandleToggleHelmOpcode(WorldPacket& recv_data); - void HandleToggleCloakOpcode(WorldPacket& recv_data); + void HandleShowingHelmOpcode(WorldPacket& recv_data); + void HandleShowingCloakOpcode(WorldPacket& recv_data); // repair void HandleRepairItemOpcode(WorldPacket& recvPacket); @@ -308,11 +308,11 @@ class TRINITY_DLL_SPEC WorldSession void HandleLogoutCancelOpcode(WorldPacket& recvPacket); // GM Ticket opcodes - void HandleGMTicketCreateOpcode(WorldPacket& recvPacket); - void HandleGMTicketUpdateOpcode(WorldPacket& recvPacket); - void HandleGMTicketDeleteOpcode(WorldPacket& recvPacket); - void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); - void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); + void HandleGMTicketCreateOpcode(WorldPacket& recvPacket); + void HandleGMTicketUpdateOpcode(WorldPacket& recvPacket); + void HandleGMTicketDeleteOpcode(WorldPacket& recvPacket); + void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); + void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); //void HandleGMSurveySubmit(WorldPacket& recvPacket); @@ -323,14 +323,14 @@ class TRINITY_DLL_SPEC WorldSession void HandleSetSelectionOpcode(WorldPacket& recvPacket); void HandleStandStateChangeOpcode(WorldPacket& recvPacket); void HandleEmoteOpcode(WorldPacket& recvPacket); - void HandleFriendListOpcode(WorldPacket& recvPacket); + void HandleContactListOpcode(WorldPacket& recvPacket); void HandleAddFriendOpcode(WorldPacket& recvPacket); static void HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 accountId, std::string friendNote); void HandleDelFriendOpcode(WorldPacket& recvPacket); void HandleAddIgnoreOpcode(WorldPacket& recvPacket); static void HandleAddIgnoreOpcodeCallBack(QueryResult *result, uint32 accountId); void HandleDelIgnoreOpcode(WorldPacket& recvPacket); - void HandleSetFriendNoteOpcode(WorldPacket& recvPacket); + void HandleSetContactNotesOpcode(WorldPacket& recvPacket); void HandleBugOpcode(WorldPacket& recvPacket); void HandleSetAmmoOpcode(WorldPacket& recvPacket); void HandleItemNameQueryOpcode(WorldPacket& recvPacket); @@ -339,8 +339,8 @@ class TRINITY_DLL_SPEC WorldSession void HandleSetFactionAtWar( WorldPacket & recv_data ); void HandleSetFactionCheat( WorldPacket & recv_data ); - void HandleSetWatchedFactionIndexOpcode(WorldPacket & recv_data); - void HandleSetWatchedFactionInactiveOpcode(WorldPacket & recv_data); + void HandleSetWatchedFactionOpcode(WorldPacket & recv_data); + void HandleSetFactionInactiveOpcode(WorldPacket & recv_data); void HandleUpdateAccountData(WorldPacket& recvPacket); void HandleRequestAccountData(WorldPacket& recvPacket); @@ -378,21 +378,21 @@ class TRINITY_DLL_SPEC WorldSession //void HandleGroupCancelOpcode(WorldPacket& recvPacket); void HandleGroupAcceptOpcode(WorldPacket& recvPacket); void HandleGroupDeclineOpcode(WorldPacket& recvPacket); - void HandleGroupUninviteNameOpcode(WorldPacket& recvPacket); + void HandleGroupUninviteOpcode(WorldPacket& recvPacket); void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket); void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket); - void HandleGroupLeaveOpcode(WorldPacket& recvPacket); - void HandleGroupPassOnLootOpcode( WorldPacket &recv_data ); + void HandleGroupDisbandOpcode(WorldPacket& recvPacket); + void HandleOptOutOfLootOpcode( WorldPacket &recv_data ); void HandleLootMethodOpcode(WorldPacket& recvPacket); void HandleLootRoll( WorldPacket &recv_data ); void HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data ); - void HandleRaidIconTargetOpcode( WorldPacket & recv_data ); + void HandleRaidTargetUpdateOpcode( WorldPacket & recv_data ); void HandleRaidReadyCheckOpcode( WorldPacket & recv_data ); - void HandleRaidReadyCheckFinishOpcode( WorldPacket & recv_data ); - void HandleRaidConvertOpcode( WorldPacket & recv_data ); + void HandleRaidReadyCheckFinishedOpcode( WorldPacket & recv_data ); + void HandleGroupRaidConvertOpcode( WorldPacket & recv_data ); void HandleGroupChangeSubGroupOpcode( WorldPacket & recv_data ); - void HandleGroupAssistantOpcode( WorldPacket & recv_data ); - void HandleGroupPromoteOpcode( WorldPacket & recv_data ); + void HandleGroupAssistantLeaderOpcode( WorldPacket & recv_data ); + void HandlePartyAssignmentOpcode( WorldPacket & recv_data ); void HandlePetitionBuyOpcode(WorldPacket& recv_data); void HandlePetitionShowSignOpcode(WorldPacket& recv_data); @@ -410,7 +410,7 @@ class TRINITY_DLL_SPEC WorldSession void HandleGuildAcceptOpcode(WorldPacket& recvPacket); void HandleGuildDeclineOpcode(WorldPacket& recvPacket); void HandleGuildInfoOpcode(WorldPacket& recvPacket); - void HandleGuildEventLogOpcode(WorldPacket& recvPacket); + void HandleGuildEventLogQueryOpcode(WorldPacket& recvPacket); void HandleGuildRosterOpcode(WorldPacket& recvPacket); void HandleGuildPromoteOpcode(WorldPacket& recvPacket); void HandleGuildDemoteOpcode(WorldPacket& recvPacket); @@ -423,14 +423,14 @@ class TRINITY_DLL_SPEC WorldSession void HandleGuildRankOpcode(WorldPacket& recvPacket); void HandleGuildAddRankOpcode(WorldPacket& recvPacket); void HandleGuildDelRankOpcode(WorldPacket& recvPacket); - void HandleGuildChangeInfoOpcode(WorldPacket& recvPacket); - void HandleGuildSaveEmblemOpcode(WorldPacket& recvPacket); + void HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket); + void HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket); void HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvPacket); void HandleTaxiQueryAvailableNodes(WorldPacket& recvPacket); void HandleActivateTaxiOpcode(WorldPacket& recvPacket); - void HandleActivateTaxiFarOpcode(WorldPacket& recvPacket); - void HandleTaxiNextDestinationOpcode(WorldPacket& recvPacket); + void HandleActivateTaxiExpressOpcode(WorldPacket& recvPacket); + void HandleMoveSplineDoneOpcode(WorldPacket& recvPacket); void HandleTabardVendorActivateOpcode(WorldPacket& recvPacket); void HandleBankerActivateOpcode(WorldPacket& recvPacket); @@ -473,16 +473,16 @@ class TRINITY_DLL_SPEC WorldSession void HandleAuctionPlaceBid( WorldPacket & recv_data ); void HandleAuctionListPendingSales( WorldPacket & recv_data ); - void HandleGetMail( WorldPacket & recv_data ); + void HandleGetMailList( WorldPacket & recv_data ); void HandleSendMail( WorldPacket & recv_data ); - void HandleTakeMoney( WorldPacket & recv_data ); - void HandleTakeItem( WorldPacket & recv_data ); - void HandleMarkAsRead( WorldPacket & recv_data ); - void HandleReturnToSender( WorldPacket & recv_data ); + void HandleMailTakeMoney( WorldPacket & recv_data ); + void HandleMailTakeItem( WorldPacket & recv_data ); + void HandleMailMarkAsRead( WorldPacket & recv_data ); + void HandleMailReturnToSender( WorldPacket & recv_data ); void HandleMailDelete( WorldPacket & recv_data ); void HandleItemTextQuery( WorldPacket & recv_data); void HandleMailCreateTextItem(WorldPacket & recv_data ); - void HandleMsgQueryNextMailtime(WorldPacket & recv_data ); + void HandleQueryNextMailTime(WorldPacket & recv_data ); void HandleCancelChanneling(WorldPacket & recv_data ); void SendItemPageInfo( ItemPrototype *itemProto ); @@ -517,14 +517,14 @@ class TRINITY_DLL_SPEC WorldSession void HandleCancelAutoRepeatSpellOpcode(WorldPacket& recvPacket); void HandleLearnTalentOpcode(WorldPacket& recvPacket); - void HandleTalentWipeOpcode(WorldPacket& recvPacket); + void HandleTalentWipeConfirmOpcode(WorldPacket& recvPacket); void HandleUnlearnSkillOpcode(WorldPacket& recvPacket); void HandleQuestgiverStatusQueryOpcode(WorldPacket& recvPacket); - void HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& recvPacket); + void HandleQuestgiverStatusMultipleQuery(WorldPacket& recvPacket); void HandleQuestgiverHelloOpcode(WorldPacket& recvPacket); void HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvPacket); - void HandleQuestgiverQuestQueryOpcode(WorldPacket& recvPacket); + void HandleQuestgiverQueryQuestOpcode(WorldPacket& recvPacket); void HandleQuestgiverChooseRewardOpcode(WorldPacket& recvPacket); void HandleQuestgiverRequestRewardOpcode(WorldPacket& recvPacket); void HandleQuestQueryOpcode(WorldPacket& recvPacket); @@ -532,22 +532,22 @@ class TRINITY_DLL_SPEC WorldSession void HandleQuestLogSwapQuest(WorldPacket& recv_data ); void HandleQuestLogRemoveQuest(WorldPacket& recv_data); void HandleQuestConfirmAccept(WorldPacket& recv_data); - void HandleQuestComplete(WorldPacket& recv_data); - void HandleQuestAutoLaunch(WorldPacket& recvPacket); - void HandleQuestPushToParty(WorldPacket& recvPacket); + void HandleQuestgiverCompleteQuest(WorldPacket& recv_data); + void HandleQuestgiverQuestAutoLaunch(WorldPacket& recvPacket); + void HandlePushQuestToParty(WorldPacket& recvPacket); void HandleQuestPushResult(WorldPacket& recvPacket); void HandleMessagechatOpcode(WorldPacket& recvPacket); void HandleTextEmoteOpcode(WorldPacket& recvPacket); void HandleChatIgnoredOpcode(WorldPacket& recvPacket); - void HandleCorpseReclaimOpcode( WorldPacket& recvPacket ); + void HandleReclaimCorpseOpcode( WorldPacket& recvPacket ); void HandleCorpseQueryOpcode( WorldPacket& recvPacket ); void HandleResurrectResponseOpcode(WorldPacket& recvPacket); void HandleSummonResponseOpcode(WorldPacket& recv_data); - void HandleChannelJoin(WorldPacket& recvPacket); - void HandleChannelLeave(WorldPacket& recvPacket); + void HandleJoinChannel(WorldPacket& recvPacket); + void HandleLeaveChannel(WorldPacket& recvPacket); void HandleChannelList(WorldPacket& recvPacket); void HandleChannelPassword(WorldPacket& recvPacket); void HandleChannelSetOwner(WorldPacket& recvPacket); @@ -560,18 +560,18 @@ class TRINITY_DLL_SPEC WorldSession void HandleChannelKick(WorldPacket& recvPacket); void HandleChannelBan(WorldPacket& recvPacket); void HandleChannelUnban(WorldPacket& recvPacket); - void HandleChannelAnnounce(WorldPacket& recvPacket); + void HandleChannelAnnouncements(WorldPacket& recvPacket); void HandleChannelModerate(WorldPacket& recvPacket); - void HandleChannelRosterQuery(WorldPacket& recvPacket); - void HandleChannelInfoQuery(WorldPacket& recvPacket); - void HandleChannelJoinNotify(WorldPacket& recvPacket); void HandleChannelDeclineInvite(WorldPacket& recvPacket); + void HandleChannelDisplayListQuery(WorldPacket& recvPacket); + void HandleGetChannelMemberCount(WorldPacket& recvPacket); + void HandleSetChannelWatch(WorldPacket& recvPacket); - void HandleCompleteCinema(WorldPacket& recvPacket); + void HandleCompleteCinematic(WorldPacket& recvPacket); void HandleNextCinematicCamera(WorldPacket& recvPacket); void HandlePageQuerySkippedOpcode(WorldPacket& recvPacket); - void HandlePageQueryOpcode(WorldPacket& recvPacket); + void HandlePageTextQueryOpcode(WorldPacket& recvPacket); void HandleTutorialFlag ( WorldPacket & recv_data ); void HandleTutorialClear( WorldPacket & recv_data ); @@ -590,24 +590,24 @@ class TRINITY_DLL_SPEC WorldSession void HandlePetCastSpellOpcode( WorldPacket& recvPacket ); void HandlePetLearnTalent( WorldPacket& recvPacket ); - void HandleSetActionBar(WorldPacket& recv_data); + void HandleSetActionBarToggles(WorldPacket& recv_data); - void HandleChangePlayerNameOpcode(WorldPacket& recv_data); + void HandleCharRenameOpcode(WorldPacket& recv_data); static void HandleChangePlayerNameOpcodeCallBack(QueryResult *result, uint32 accountId, std::string newname); - void HandleDeclinedPlayerNameOpcode(WorldPacket& recv_data); + void HandleSetPlayerDeclinedNames(WorldPacket& recv_data); - void HandleTotemDestroy(WorldPacket& recv_data); + void HandleTotemDestroyed(WorldPacket& recv_data); //BattleGround - void HandleBattleGroundHelloOpcode(WorldPacket &recv_data); - void HandleBattleGroundJoinOpcode(WorldPacket &recv_data); + void HandleBattlemasterHelloOpcode(WorldPacket &recv_data); + void HandleBattlemasterJoinOpcode(WorldPacket &recv_data); void HandleBattleGroundPlayerPositionsOpcode(WorldPacket& recv_data); - void HandleBattleGroundPVPlogdataOpcode( WorldPacket &recv_data ); - void HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ); - void HandleBattleGroundListOpcode( WorldPacket &recv_data ); - void HandleBattleGroundLeaveOpcode( WorldPacket &recv_data ); - void HandleBattleGroundArenaJoin( WorldPacket &recv_data ); - void HandleBattleGroundReportAFK( WorldPacket &recv_data ); + void HandlePVPLogDataOpcode( WorldPacket &recv_data ); + void HandleBattleFieldPortOpcode( WorldPacket &recv_data ); + void HandleBattlefieldListOpcode( WorldPacket &recv_data ); + void HandleLeaveBattlefieldOpcode( WorldPacket &recv_data ); + void HandleBattlemasterJoinArena( WorldPacket &recv_data ); + void HandleReportPvPAFK( WorldPacket &recv_data ); void HandleWardenDataOpcode(WorldPacket& recv_data); void HandleWorldTeleportOpcode(WorldPacket& recv_data); @@ -615,64 +615,64 @@ class TRINITY_DLL_SPEC WorldSession void HandleRandomRollOpcode(WorldPacket& recv_data); void HandleFarSightOpcode(WorldPacket& recv_data); void HandleSetLfgOpcode(WorldPacket& recv_data); - void HandleDungeonDifficultyOpcode(WorldPacket& recv_data); - void HandleMoveFlyModeChangeAckOpcode(WorldPacket& recv_data); - void HandleLfgAutoJoinOpcode(WorldPacket& recv_data); - void HandleLfgCancelAutoJoinOpcode(WorldPacket& recv_data); - void HandleLfmAutoAddMembersOpcode(WorldPacket& recv_data); - void HandleLfmCancelAutoAddmembersOpcode(WorldPacket& recv_data); + void HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data); + void HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data); + void HandleLfgSetAutoJoinOpcode(WorldPacket& recv_data); + void HandleLfgClearAutoJoinOpcode(WorldPacket& recv_data); + void HandleLfmSetAutoFillOpcode(WorldPacket& recv_data); + void HandleLfmClearAutoFillOpcode(WorldPacket& recv_data); void HandleLfgClearOpcode(WorldPacket& recv_data); - void HandleLfmSetNoneOpcode(WorldPacket& recv_data); - void HandleLfmSetOpcode(WorldPacket& recv_data); - void HandleLfgSetCommentOpcode(WorldPacket& recv_data); - void HandleChooseTitleOpcode(WorldPacket& recv_data); - void HandleRealmStateRequestOpcode(WorldPacket& recv_data); + void HandleLfmClearOpcode(WorldPacket& recv_data); + void HandleSetLfmOpcode(WorldPacket& recv_data); + void HandleSetLfgCommentOpcode(WorldPacket& recv_data); + void HandleSetTitleOpcode(WorldPacket& recv_data); + void HandleRealmSplitOpcode(WorldPacket& recv_data); void HandleTimeSyncResp(WorldPacket& recv_data); void HandleWhoisOpcode(WorldPacket& recv_data); void HandleResetInstancesOpcode(WorldPacket& recv_data); // Arena Team - void HandleInspectArenaStatsOpcode(WorldPacket& recv_data); + void HandleInspectArenaTeamsOpcode(WorldPacket& recv_data); void HandleArenaTeamQueryOpcode(WorldPacket& recv_data); void HandleArenaTeamRosterOpcode(WorldPacket& recv_data); - void HandleArenaTeamAddMemberOpcode(WorldPacket& recv_data); - void HandleArenaTeamInviteAcceptOpcode(WorldPacket& recv_data); - void HandleArenaTeamInviteDeclineOpcode(WorldPacket& recv_data); + void HandleArenaTeamInviteOpcode(WorldPacket& recv_data); + void HandleArenaTeamAcceptOpcode(WorldPacket& recv_data); + void HandleArenaTeamDeclineOpcode(WorldPacket& recv_data); void HandleArenaTeamLeaveOpcode(WorldPacket& recv_data); - void HandleArenaTeamRemoveFromTeamOpcode(WorldPacket& recv_data); + void HandleArenaTeamRemoveOpcode(WorldPacket& recv_data); void HandleArenaTeamDisbandOpcode(WorldPacket& recv_data); - void HandleArenaTeamPromoteToCaptainOpcode(WorldPacket& recv_data); + void HandleArenaTeamLeaderOpcode(WorldPacket& recv_data); void HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data); void HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data); - void HandleDismountOpcode(WorldPacket& recv_data); + void HandleCancelMountAuraOpcode(WorldPacket& recv_data); void HandleSelfResOpcode(WorldPacket& recv_data); - void HandleReportSpamOpcode(WorldPacket& recv_data); + void HandleComplainOpcode(WorldPacket& recv_data); void HandleRequestPetInfoOpcode(WorldPacket& recv_data); // Socket gem void HandleSocketOpcode(WorldPacket& recv_data); - void HandleCancelTempItemEnchantmentOpcode(WorldPacket& recv_data); + void HandleCancelTempEnchantmentOpcode(WorldPacket& recv_data); - void HandleChannelEnableVoiceOpcode(WorldPacket & recv_data); - void HandleVoiceSettingsOpcode(WorldPacket& recv_data); - void HandleChannelVoiceChatQuery(WorldPacket& recv_data); + void HandleChannelVoiceOnOpcode(WorldPacket & recv_data); + void HandleVoiceSessionEnableOpcode(WorldPacket& recv_data); + void HandleSetActiveVoiceChannel(WorldPacket& recv_data); void HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data); // Guild Bank - void HandleGuildBankGetRights(WorldPacket& recv_data); - void HandleGuildBankGetMoneyAmount(WorldPacket& recv_data); - void HandleGuildBankQuery(WorldPacket& recv_data); - void HandleGuildBankTabColon(WorldPacket& recv_data); - void HandleGuildBankLog(WorldPacket& recv_data); - void HandleGuildBankDeposit(WorldPacket& recv_data); - void HandleGuildBankWithdraw(WorldPacket& recv_data); - void HandleGuildBankDepositItem(WorldPacket& recv_data); - void HandleGuildBankModifyTab(WorldPacket& recv_data); + void HandleGuildPermissions(WorldPacket& recv_data); + void HandleGuildBankMoneyWithdrawn(WorldPacket& recv_data); + void HandleGuildBankerActivate(WorldPacket& recv_data); + void HandleGuildBankQueryTab(WorldPacket& recv_data); + void HandleGuildBankLogQuery(WorldPacket& recv_data); + void HandleGuildBankDepositMoney(WorldPacket& recv_data); + void HandleGuildBankWithdrawMoney(WorldPacket& recv_data); + void HandleGuildBankSwapItems(WorldPacket& recv_data); + void HandleGuildBankUpdateTab(WorldPacket& recv_data); void HandleGuildBankBuyTab(WorldPacket& recv_data); - void HandleGuildBankTabText(WorldPacket& recv_data); - void HandleGuildBankSetTabText(WorldPacket& recv_data); + void HandleQueryGuildBankTabText(WorldPacket& recv_data); + void HandleSetGuildBankTabText(WorldPacket& recv_data); // Calendar void HandleCalendarGetCalendar(WorldPacket& recv_data); @@ -695,7 +695,7 @@ class TRINITY_DLL_SPEC WorldSession void HandleAlterAppearance(WorldPacket& recv_data); void HandleRemoveGlyph(WorldPacket& recv_data); void HandleCharCustomize(WorldPacket& recv_data); - void HandleInspectAchievements(WorldPacket& recv_data); + void HandleQueryInspectAchievements(WorldPacket& recv_data); private: // private trade methods void moveItems(Item* myItems[], Item* hisItems[]); diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h index 16988632871..7dc6b5483df 100644 --- a/src/shared/ByteBuffer.h +++ b/src/shared/ByteBuffer.h @@ -369,7 +369,7 @@ class ByteBuffer { if ((i == (j*8)) && ((i != (k*16)))) { - if (read<uint8>(i) < 0x0F) + if (read<uint8>(i) < 0x10) { sLog.outDebugInLine("| 0%X ", read<uint8>(i) ); } @@ -381,7 +381,7 @@ class ByteBuffer } else if (i == (k*16)) { - if (read<uint8>(i) < 0x0F) + if (read<uint8>(i) < 0x10) { sLog.outDebugInLine("\n"); @@ -399,7 +399,7 @@ class ByteBuffer } else { - if (read<uint8>(i) < 0x0F) + if (read<uint8>(i) < 0x10) { sLog.outDebugInLine("0%X ", read<uint8>(i) ); } diff --git a/src/shared/Common.h b/src/shared/Common.h index 37ced4c8e11..735c57eedbe 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -103,6 +103,7 @@ #include "LockedQueue.h" #include "Threading.h" +#include <ace/Basic_Types.h> #include <ace/Guard_T.h> #include <ace/RW_Thread_Mutex.h> #include <ace/Thread_Mutex.h> @@ -130,8 +131,6 @@ #include <float.h> #define I64FMT "%016I64X" -#define I64FMTD "%I64u" -#define SI64FMTD "%I64d" #define snprintf _snprintf #define atoll __atoi64 #define vsnprintf _vsnprintf @@ -143,10 +142,15 @@ #define stricmp strcasecmp #define strnicmp strncasecmp #define I64FMT "%016llX" -#define I64FMTD "%llu" -#define SI64FMTD "%lld" + #endif +#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER +#define UI64LIT(N) ACE_UINT64_LITERAL(N) + +#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER +#define SI64LIT(N) ACE_INT64_LITERAL(N) + inline float finiteAlways(float f) { return finite(f) ? f : 0.0f; } #define atol(a) strtoul( a, NULL, 10) diff --git a/src/shared/Database/Field.h b/src/shared/Database/Field.h index da6a865c6f2..f365a96df64 100644 --- a/src/shared/Database/Field.h +++ b/src/shared/Database/Field.h @@ -59,7 +59,7 @@ class Field if(mValue) { uint64 value; - sscanf(mValue,I64FMTD,&value); + sscanf(mValue,UI64FMTD,&value); return value; } else diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index f3fcae1faf7..d81594c9787 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -353,7 +353,7 @@ void Log::outDB( LogTypes type, const char * str ) LoginDatabase.escape_string(new_str); LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, string) " - "VALUES ("I64FMTD", %u, %u, '%s');", uint64(time(0)), realm, (uint32)type, new_str.c_str()); + "VALUES (" UI64FMTD ", %u, %u, '%s');", uint64(time(0)), realm, (uint32)type, new_str.c_str()); } void Log::outString( const char * str, ... ) diff --git a/src/shared/vmap/CoordModelMapping.cpp b/src/shared/vmap/CoordModelMapping.cpp index c362101ffb4..5dd23f306aa 100644 --- a/src/shared/vmap/CoordModelMapping.cpp +++ b/src/shared/vmap/CoordModelMapping.cpp @@ -87,63 +87,65 @@ namespace VMAP bool CoordModelMapping::readCoordinateMapping(const std::string& pDirectoryFileName) { FILE *f = fopen(pDirectoryFileName.c_str(), "rb"); - bool result = false; + if(!f) + { + printf("ERROR: Can't open file: %s\n",pDirectoryFileName.c_str()); + return false; + } + char buffer[500+1]; - if(f) + CMappingEntry* cMappingEntry; + while(fgets(buffer, 500, f)) { - result = true; - CMappingEntry* cMappingEntry; - while(fgets(buffer, 500, f)) - { - //char namebuffer[500]; - char positionbuffer[500]; - int xpos, ypos, noVec; - float scale; - xpos = ypos = noVec = 0; + //char namebuffer[500]; + char positionbuffer[500]; + int xpos, ypos, noVec; + float scale; + xpos = ypos = noVec = 0; - //sscanf(buffer, "%d %d %s %s %f %d", &xpos, &ypos, namebuffer,positionbuffer, &scale, &noVec); + //sscanf(buffer, "%d %d %s %s %f %d", &xpos, &ypos, namebuffer,positionbuffer, &scale, &noVec); - // this is ugly, but the format has no read delimiter and a space could be in the first part of the name - int nameStart = findPosChar(buffer, ' ', 2);// find the 2. space - if(nameStart > -1 && (iFilterMethod == NULL || (*iFilterMethod)(buffer))) + // this is ugly, but the format has no read delimiter and a space could be in the first part of the name + int nameStart = findPosChar(buffer, ' ', 2);// find the 2. space + if(nameStart > -1 && (iFilterMethod == NULL || (*iFilterMethod)(buffer))) + { + ++nameStart; + // find the 1. / (now a space only can be found at the end of the name) + int nameEnd = nameStart + findPosChar(&buffer[nameStart], '/', 1); + // find the 1. space (after the name) + nameEnd += findPosChar(&buffer[nameEnd], ' ', 1); + buffer[nameEnd] = 0; // terminate the name + + sscanf(buffer, "%d %d", &xpos, &ypos); + sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec); + unsigned int mapId = getMapIdFromFilename(std::string(&buffer[nameStart])); + if(!iMapIds.contains(mapId)) { - ++nameStart; - // find the 1. / (now a space only can be found at the end of the name) - int nameEnd = nameStart + findPosChar(&buffer[nameStart], '/', 1); - // find the 1. space (after the name) - nameEnd += findPosChar(&buffer[nameEnd], ' ', 1); - buffer[nameEnd] = 0; // terminate the name - - sscanf(buffer, "%d %d", &xpos, &ypos); - sscanf(&buffer[nameEnd+1], "%s %f %d", positionbuffer, &scale, &noVec); - unsigned int mapId = getMapIdFromFilename(std::string(&buffer[nameStart])); - if(!iMapIds.contains(mapId)) - { - iMapIds.append(mapId); - } - if(!isWorldAreaMap(mapId)) - { - xpos = 0; // store all files under the groupKey - ypos = 0; - } - - std::string key = CMappingEntry::getKeyString(mapId, xpos, ypos); - cMappingEntry = getCMappingEntry(key); - if(cMappingEntry == 0) - { - cMappingEntry = new CMappingEntry(mapId, xpos, ypos); - addCMappingEntry(cMappingEntry); - } - char namebuffer2[500]; - sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale); - cMappingEntry->addFilename(namebuffer2); - //break; + iMapIds.append(mapId); + printf("Coords for map %u...\n",mapId); } + if(!isWorldAreaMap(mapId)) + { + xpos = 0; // store all files under the groupKey + ypos = 0; + } + + std::string key = CMappingEntry::getKeyString(mapId, xpos, ypos); + cMappingEntry = getCMappingEntry(key); + if(cMappingEntry == 0) + { + cMappingEntry = new CMappingEntry(mapId, xpos, ypos); + addCMappingEntry(cMappingEntry); + } + char namebuffer2[500]; + sprintf(namebuffer2, "%d %s#%s_%f", noVec, &buffer[nameStart], positionbuffer, scale); + cMappingEntry->addFilename(namebuffer2); + //break; } - fclose(f); } - return result; + fclose(f); + return true; } //============================================================ diff --git a/src/shared/vmap/TileAssembler.cpp b/src/shared/vmap/TileAssembler.cpp index 7ac4f683248..c2918a64fa4 100644 --- a/src/shared/vmap/TileAssembler.cpp +++ b/src/shared/vmap/TileAssembler.cpp @@ -150,447 +150,454 @@ namespace VMAP # endif #endif - bool result = true; std::string fname = iSrcDir; fname.append("/"); fname.append("dir"); iCoordModelMapping->setModelNameFilterMethod(iFilterMethod); - iCoordModelMapping->readCoordinateMapping(fname); + + printf("Read coordinate mapping...\n"); + if(!iCoordModelMapping->readCoordinateMapping(fname)) + return false; Array<unsigned int> mapIds = iCoordModelMapping->getMaps(); if(mapIds.size() == 0) { - result = false; + printf("Fatal error: empty map list!\n"); + return false; } - for(int i=0; i<mapIds.size() && result; ++i) + + for(int i=0; i<mapIds.size(); ++i) { unsigned int mapId = mapIds[i]; #ifdef _ASSEMBLER_DEBUG if(mapId == 0) // "Azeroth" just for debug { - for(int x=28; x<29 && result; ++x) //debug + for(int x=28; x<29; ++x) //debug { - for(int y=28; y<29 && result; ++y) + for(int y=28; y<29; ++y) { - #else - // ignore DeeprunTram (369) it is too large for short vector and not important - // ignore test (13), Test (29) , development (451) - if(mapId != 369 && mapId != 13 && mapId != 29 && mapId != 451) + #else + // ignore DeeprunTram (369) it is too large for short vector and not important + // ignore test (13), Test (29) , development (451) + if(mapId != 369 && mapId != 13 && mapId != 29 && mapId != 451) + { + for(int x=0; x<66; ++x) + { + for(int y=0; y<66; ++y) + { + #endif + Array<ModelContainer*> mc; + std::string dirname; + char buffer[100]; + if(iCoordModelMapping->isWorldAreaMap(mapId) && x<65 && y<65) { - for(int x=0; x<66 && result; ++x) - { - for(int y=0; y<66 && result; ++y) - { - #endif - Array<ModelContainer*> mc; - std::string dirname; - char buffer[100]; - if(iCoordModelMapping->isWorldAreaMap(mapId) && x<65 && y<65) - { - sprintf(buffer, "%03u_%d_%d",mapId,y,x); // Let's flip x and y here - dirname = std::string(buffer); - } - else - { - sprintf(buffer, "%03u",mapId); - dirname = std::string(buffer); - } - result = fillModelContainerArray(dirname, mapId, x, y, mc); - emptyArray(mc); - } - } + sprintf(buffer, "%03u_%d_%d",mapId,y,x); // Let's flip x and y here + dirname = std::string(buffer); + printf("%s...\n",dirname.c_str()); } - } - #ifdef _ASSEMBLER_DEBUG - if(::g_df) fclose(::g_df); - #endif - - return result; - } + else + { + sprintf(buffer, "%03u",mapId); + dirname = std::string(buffer); - //================================================================= + // prevent spam for small maps + if(x==0 && y==0) + printf("%s...\n",dirname.c_str()); + } - bool TileAssembler::fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, Array<ModelContainer*>& pMC) - { - bool result = true; - ModelContainer* modelContainer; + bool result = fillModelContainerArray(dirname, mapId, x, y, mc); + emptyArray(mc); - NameCollection nameCollection = iCoordModelMapping->getFilenamesForCoordinate(pMapId, pXPos, pYPos); - if(nameCollection.size() > 0) - { - result = false; - char dirfilename[500]; - sprintf(dirfilename,"%s/%s.vmdir",iDestDir.c_str(),pDirFileName.c_str()); - FILE *dirfile = fopen(dirfilename, "ab"); - if(dirfile) - { - result = true; - char destnamebuffer[500]; - char fullnamedestnamebuffer[500]; - if(nameCollection.iMainFiles.size() >0) - { - sprintf(destnamebuffer,"%03u_%i_%i.vmap",pMapId, pYPos, pXPos); // flip it here too - std::string checkDoubleStr = std::string(dirfilename); - checkDoubleStr.append("##"); - checkDoubleStr.append(std::string(destnamebuffer)); - // Check, if same file already is in the same dir file - if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) - { - iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); - fprintf(dirfile, "%s\n",destnamebuffer); - sprintf(fullnamedestnamebuffer,"%s/%s",iDestDir.c_str(),destnamebuffer); - modelContainer = processNames(nameCollection.iMainFiles, fullnamedestnamebuffer); - if(modelContainer) - { - pMC.append(modelContainer); - } - else - { - result = false; - } - } - } - // process the large singe files - int pos = 0; - while(result && (pos < nameCollection.iSingeFiles.size())) - { - std::string destFileName = iDestDir; - destFileName.append("/"); - std::string dirEntryName = getDirEntryNameFromModName(pMapId,nameCollection.iSingeFiles[pos]); - std::string checkDoubleStr = std::string(dirfilename); - checkDoubleStr.append("##"); - checkDoubleStr.append(nameCollection.iSingeFiles[pos]); - // Check, if same file already is in the same dir file - if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) - { - iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); - fprintf(dirfile, "%s\n",dirEntryName.c_str()); - destFileName.append(dirEntryName); - - Array<std::string> positionarray; - positionarray.append(nameCollection.iSingeFiles[pos]); - - if(!iCoordModelMapping->isAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos])) - { - modelContainer = processNames(positionarray, destFileName.c_str()); - iCoordModelMapping->addAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos]); - if(modelContainer) - { - pMC.append(modelContainer); - } - else - { - result = false; - } - } - } - ++pos; - } - fclose(dirfile); - } + if(!result) + return false; } - return(result); } + } + } + #ifdef _ASSEMBLER_DEBUG + if(::g_df) fclose(::g_df); + #endif + + return true; + } + + //================================================================= + + bool TileAssembler::fillModelContainerArray(const std::string& pDirFileName, unsigned int pMapId, int pXPos, int pYPos, Array<ModelContainer*>& pMC) + { + ModelContainer* modelContainer; + + NameCollection nameCollection = iCoordModelMapping->getFilenamesForCoordinate(pMapId, pXPos, pYPos); + if(nameCollection.size() == 0) + return true; // no data... + + char dirfilename[500]; + sprintf(dirfilename,"%s/%s.vmdir",iDestDir.c_str(),pDirFileName.c_str()); + FILE *dirfile = fopen(dirfilename, "ab"); + if(!dirfile) + { + printf("ERROR: Can't create file %s",dirfilename); + return false; + } + + char destnamebuffer[500]; + char fullnamedestnamebuffer[500]; + + if(nameCollection.iMainFiles.size() >0) + { + sprintf(destnamebuffer,"%03u_%i_%i.vmap",pMapId, pYPos, pXPos); // flip it here too + std::string checkDoubleStr = std::string(dirfilename); + checkDoubleStr.append("##"); + checkDoubleStr.append(std::string(destnamebuffer)); + // Check, if same file already is in the same dir file + if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) + { + iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); + fprintf(dirfile, "%s\n",destnamebuffer); + sprintf(fullnamedestnamebuffer,"%s/%s",iDestDir.c_str(),destnamebuffer); + modelContainer = processNames(nameCollection.iMainFiles, fullnamedestnamebuffer); + if(modelContainer) + pMC.append(modelContainer); + else + printf("warning: (if) problems in processing data for %s\n",destnamebuffer); + } + } + // process the large singe files + int pos = 0; + while(pos < nameCollection.iSingeFiles.size()) + { + std::string destFileName = iDestDir; + destFileName.append("/"); + std::string dirEntryName = getDirEntryNameFromModName(pMapId,nameCollection.iSingeFiles[pos]); + std::string checkDoubleStr = std::string(dirfilename); + checkDoubleStr.append("##"); + checkDoubleStr.append(nameCollection.iSingeFiles[pos]); + // Check, if same file already is in the same dir file + if(!iCoordModelMapping->isAlreadyProcessedSingleFile(checkDoubleStr)) + { + iCoordModelMapping->addAlreadyProcessedSingleFile(checkDoubleStr); + fprintf(dirfile, "%s\n",dirEntryName.c_str()); + destFileName.append(dirEntryName); - //================================================================= + Array<std::string> positionarray; + positionarray.append(nameCollection.iSingeFiles[pos]); - void removeEntriesFromTree(AABSPTree<SubModel *>* pTree) + if(!iCoordModelMapping->isAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos])) { - Array<SubModel *> submodelArray; - pTree->getMembers(submodelArray); - int no = submodelArray.size(); - while(no > 0) - { - --no; - delete submodelArray[no]; - } + modelContainer = processNames(positionarray, destFileName.c_str()); + iCoordModelMapping->addAlreadyProcessedSingleFile(nameCollection.iSingeFiles[pos]); + if(modelContainer) + pMC.append(modelContainer); + else + printf("warning: (while) problems in processing data for %s\n",destFileName.c_str()); } + } + ++pos; + } - //================================================================= + fclose(dirfile); + return true; + } - ModelContainer* TileAssembler::processNames(const Array<std::string>& pPositions, const char* pDestFileName) - { - ModelContainer *modelContainer = 0; + //================================================================= - Vector3 basepos = Vector3(0,0,0); - AABSPTree<SubModel *>* mainTree = new AABSPTree<SubModel *>(); + void removeEntriesFromTree(AABSPTree<SubModel *>* pTree) + { + Array<SubModel *> submodelArray; + pTree->getMembers(submodelArray); + int no = submodelArray.size(); + while(no > 0) + { + --no; + delete submodelArray[no]; + } + } - int pos = 0; + //================================================================= - bool result = true; - while(result && (pos < pPositions.size())) - { - std::string modelPosString = pPositions[pos]; - std::string modelFileName = getModNameFromModPosName(modelPosString); + ModelContainer* TileAssembler::processNames(const Array<std::string>& pPositions, const char* pDestFileName) + { + ModelContainer *modelContainer = 0; - if(!fillModelIntoTree(mainTree, basepos, modelPosString, modelFileName)) - { - result = false; - break; - } - ++pos; - } - if(result && mainTree->size() > 0) - { - mainTree->balance(); - modelContainer = new ModelContainer(mainTree); - modelContainer->writeFile(pDestFileName); - } - removeEntriesFromTree(mainTree); + Vector3 basepos = Vector3(0,0,0); + AABSPTree<SubModel *>* mainTree = new AABSPTree<SubModel *>(); - delete mainTree; + int pos = 0; - return(modelContainer); - } + bool result = true; + while(result && (pos < pPositions.size())) + { + std::string modelPosString = pPositions[pos]; + std::string modelFileName = getModNameFromModPosName(modelPosString); - //================================================================= - bool TileAssembler::readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, AABSPTree<SubModel *> *pMainTree) - { - bool result = false; - - std::string filename = iSrcDir; - if(filename.length() >0) - filename.append("/"); - filename.append(pModelFilename); - FILE *rf = fopen(filename.c_str(), "rb"); - if(!rf) - { - // depending on the extractor version, the data could be located in the root dir - std::string baseModelFilename = pModelFilename.substr((pModelFilename.find_first_of("/")+1),pModelFilename.length()); - filename = iSrcDir; - if(filename.length() >0) - filename.append("/"); - filename.append(baseModelFilename); - rf = fopen(filename.c_str(), "rb"); - } - char ident[8]; - - int trianglecount =0; - - #ifdef _ASSEMBLER_DEBUG - int startgroup = 0; //2; - int endgroup = INT_MAX; //2; - fprintf(::g_df,"-------------------------------------------------\n"); - fprintf(::g_df,"%s\n", pModelFilename.c_str()); - fprintf(::g_df,"-------------------------------------------------\n"); - #else - int startgroup = 0; - int endgroup = INT_MAX; - #endif - - // temporary use defines to simplify read/check code (close file and return at fail) - #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { fclose(rf); return(false); } - #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { fclose(rf); return(false); } - - if(rf) - { - READ_OR_RETURN(&ident, 8); - if(strcmp(ident, "VMAP001") == 0) - { - // OK, do nothing - } - else if(strcmp(ident, "VMAP002") == 0) - { - // we have to read one int. This is needed during the export and we have to skip it here - int tempNVectors; - READ_OR_RETURN(&tempNVectors, sizeof(int)); + if(!fillModelIntoTree(mainTree, basepos, modelPosString, modelFileName)) + { + result = false; + break; + } + ++pos; + } + if(result && mainTree->size() > 0) + { + mainTree->balance(); + modelContainer = new ModelContainer(mainTree); + modelContainer->writeFile(pDestFileName); + } + removeEntriesFromTree(mainTree); - } - else - { - // wrong version - fclose(rf); - return(false); - } - G3D::uint32 groups; - char blockId[5]; - blockId[4] = 0; - int blocksize; + delete mainTree; - READ_OR_RETURN(&groups, sizeof(G3D::uint32)); + return(modelContainer); + } - for(int g=0;g<(int)groups;g++) - { - // group MUST NOT have more then 65536 indexes !! Array will have a problem with that !! (strange ...) - Array<int> tempIndexArray; - Array<Vector3> tempVertexArray; - - AABSPTree<Triangle> *gtree = new AABSPTree<Triangle>(); - - // add free gtree at fail - #undef READ_OR_RETURN - #undef CMP_OR_RETURN - #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { fclose(rf); delete gtree; return(false); } - #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { fclose(rf); delete gtree; return(false); } - - G3D::uint32 flags; - READ_OR_RETURN(&flags, sizeof(G3D::uint32)); - - G3D::uint32 branches; - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "GRP "); - READ_OR_RETURN(&blocksize, sizeof(int)); - READ_OR_RETURN(&branches, sizeof(G3D::uint32)); - for(int b=0;b<(int)branches; b++) - { - G3D::uint32 indexes; - // indexes for each branch (not used jet) - READ_OR_RETURN(&indexes, sizeof(G3D::uint32)); - } - - // ---- indexes - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "INDX"); - READ_OR_RETURN(&blocksize, sizeof(int)); - unsigned int nindexes; - READ_OR_RETURN(&nindexes, sizeof(G3D::uint32)); - if(nindexes >0) - { - unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)]; - READ_OR_RETURN(indexarray, sizeof(unsigned short)); - for(int i=0;i<(int)nindexes; i++) - { - unsigned short val = indexarray[i]; - tempIndexArray.append(val); - } - delete[] indexarray; - } - - // ---- vectors - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "VERT"); - READ_OR_RETURN(&blocksize, sizeof(int)); - unsigned int nvectors; - READ_OR_RETURN(&nvectors, sizeof(int)); - - float *vectorarray = 0; - - // add vectorarray free - #undef READ_OR_RETURN - #undef CMP_OR_RETURN - #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { fclose(rf); delete gtree; delete[] vectorarray; return(false); } - #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { fclose(rf); delete gtree; delete[] vectorarray; return(false); } - - if(nvectors >0) - { - vectorarray = new float[nvectors*sizeof(float)*3]; - READ_OR_RETURN(vectorarray, sizeof(float)*3); - } - // ----- liquit - if(flags & 1) - { - // we have liquit -> not handled yet ... skip - READ_OR_RETURN(&blockId, 4); - CMP_OR_RETURN(blockId, "LIQU"); - READ_OR_RETURN(&blocksize, sizeof(int)); - fseek(rf, blocksize, SEEK_CUR); - } - - - for(unsigned int i=0, indexNo=0; indexNo<nvectors; indexNo++) - { - Vector3 v = Vector3(vectorarray[i+2], vectorarray[i+1], vectorarray[i+0]); - i+=3; - v = pModelPosition.transform(v); - - float swapy = v.y; - v.y = v.x; - v.x = swapy; - - tempVertexArray.append(v); - } - - // ---- calculate triangles - int rest = nindexes%3; - if(rest != 0) - { - nindexes -= rest; - } - - for(unsigned int i=0;i<(nindexes);) - { - Triangle t = Triangle(tempVertexArray[tempIndexArray[i+2]], tempVertexArray[tempIndexArray[i+1]], tempVertexArray[tempIndexArray[i+0]] ); - i+=3; - ++trianglecount; - if(g>= startgroup && g <= endgroup) - { - gtree->insert(t); - } - } - - // drop of temporary use defines - #undef READ_OR_RETURN - #undef CMP_OR_RETURN - - if(vectorarray != 0) - { - delete vectorarray; - } - - if(gtree->size() >0) - { - gtree->balance(); - SubModel *sm = new SubModel(gtree); - #ifdef _ASSEMBLER_DEBUG - if(::g_df) fprintf(::g_df,"group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); - if(sm->getNTriangles() != gtree->memberTable.size()) - { - if(::g_df) fprintf(::g_df,"ERROR !!!! group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); - } - #endif - sm->setBasePosition(pModelPosition.iPos); - pMainTree->insert(sm); - } - delete gtree; - } - fclose(rf); - result = true; - } - return(result); - } + //================================================================= + bool TileAssembler::readRawFile(std::string& pModelFilename, ModelPosition& pModelPosition, AABSPTree<SubModel *> *pMainTree) + { + std::string filename = iSrcDir; + if(filename.length() >0) + filename.append("/"); + filename.append(pModelFilename); + FILE *rf = fopen(filename.c_str(), "rb"); + if(!rf) + { + // depending on the extractor version, the data could be located in the root dir + std::string baseModelFilename = pModelFilename.substr((pModelFilename.find_first_of("/")+1),pModelFilename.length()); + filename = iSrcDir; + if(filename.length() >0) + filename.append("/"); + filename.append(baseModelFilename); + rf = fopen(filename.c_str(), "rb"); + } + + if(!rf) + { + printf("ERROR: Can't open model file in form: %s",pModelFilename.c_str()); + printf("... or form: %s",filename ); + return false; + } + + char ident[8]; + + int trianglecount =0; + + #ifdef _ASSEMBLER_DEBUG + int startgroup = 0; //2; + int endgroup = INT_MAX; //2; + fprintf(::g_df,"-------------------------------------------------\n"); + fprintf(::g_df,"%s\n", pModelFilename.c_str()); + fprintf(::g_df,"-------------------------------------------------\n"); + #else + int startgroup = 0; + int endgroup = INT_MAX; + #endif + + // temporary use defines to simplify read/check code (close file and return at fail) + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); return(false); } + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); return(false); } + + READ_OR_RETURN(&ident, 8); + if(strcmp(ident, "VMAP001") == 0) + { + // OK, do nothing + } + else if(strcmp(ident, "VMAP002") == 0) + { + // we have to read one int. This is needed during the export and we have to skip it here + int tempNVectors; + READ_OR_RETURN(&tempNVectors, sizeof(int)); + + } + else + { + // wrong version + fclose(rf); + return(false); + } + G3D::uint32 groups; + char blockId[5]; + blockId[4] = 0; + int blocksize; - //================================================================= + READ_OR_RETURN(&groups, sizeof(G3D::uint32)); - bool TileAssembler::fillModelIntoTree(AABSPTree<SubModel *> *pMainTree, const Vector3& pBasePos, std::string& pPos, std::string& pModelFilename) + for(int g=0;g<(int)groups;g++) + { + // group MUST NOT have more then 65536 indexes !! Array will have a problem with that !! (strange ...) + Array<int> tempIndexArray; + Array<Vector3> tempVertexArray; + + AABSPTree<Triangle> *gtree = new AABSPTree<Triangle>(); + + // add free gtree at fail + #undef READ_OR_RETURN + #undef CMP_OR_RETURN + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); delete gtree; return(false); } + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); delete gtree; return(false); } + + G3D::uint32 flags; + READ_OR_RETURN(&flags, sizeof(G3D::uint32)); + + G3D::uint32 branches; + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "GRP "); + READ_OR_RETURN(&blocksize, sizeof(int)); + READ_OR_RETURN(&branches, sizeof(G3D::uint32)); + for(int b=0;b<(int)branches; b++) + { + G3D::uint32 indexes; + // indexes for each branch (not used jet) + READ_OR_RETURN(&indexes, sizeof(G3D::uint32)); + } + + // ---- indexes + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "INDX"); + READ_OR_RETURN(&blocksize, sizeof(int)); + unsigned int nindexes; + READ_OR_RETURN(&nindexes, sizeof(G3D::uint32)); + if(nindexes >0) + { + unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)]; + READ_OR_RETURN(indexarray, nindexes*sizeof(unsigned short)); + for(int i=0;i<(int)nindexes; i++) { - bool result = false; - ModelPosition modelPosition; - getModelPosition(pPos, modelPosition); - // all should be relative to object base position - modelPosition.moveToBasePos(pBasePos); + unsigned short val = indexarray[i]; + tempIndexArray.append(val); + } + delete[] indexarray; + } + + // ---- vectors + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "VERT"); + READ_OR_RETURN(&blocksize, sizeof(int)); + unsigned int nvectors; + READ_OR_RETURN(&nvectors, sizeof(int)); + + float *vectorarray = 0; + + // add vectorarray free + #undef READ_OR_RETURN + #undef CMP_OR_RETURN + #define READ_OR_RETURN(V,S) if(fread((V), (S), 1, rf) != 1) { \ + fclose(rf); delete gtree; delete[] vectorarray; return(false); } + #define CMP_OR_RETURN(V,S) if(strcmp((V),(S)) != 0) { \ + fclose(rf); delete gtree; delete[] vectorarray; return(false); } + + if(nvectors >0) + { + vectorarray = new float[nvectors*sizeof(float)*3]; + READ_OR_RETURN(vectorarray, nvectors*sizeof(float)*3); + } + // ----- liquit + if(flags & 1) + { + // we have liquit -> not handled yet ... skip + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "LIQU"); + READ_OR_RETURN(&blocksize, sizeof(int)); + fseek(rf, blocksize, SEEK_CUR); + } - modelPosition.init(); - if(readRawFile(pModelFilename, modelPosition, pMainTree)) - { - result = true; - } + for(unsigned int i=0, indexNo=0; indexNo<nvectors; indexNo++) + { + Vector3 v = Vector3(vectorarray[i+2], vectorarray[i+1], vectorarray[i+0]); + i+=3; + v = pModelPosition.transform(v); + + float swapy = v.y; + v.y = v.x; + v.x = swapy; + + tempVertexArray.append(v); + } + + // ---- calculate triangles + int rest = nindexes%3; + if(rest != 0) + { + nindexes -= rest; + } - return result; + for(unsigned int i=0;i<(nindexes);) + { + Triangle t = Triangle(tempVertexArray[tempIndexArray[i+2]], tempVertexArray[tempIndexArray[i+1]], tempVertexArray[tempIndexArray[i+0]] ); + i+=3; + ++trianglecount; + if(g>= startgroup && g <= endgroup) + { + gtree->insert(t); } + } + + // drop of temporary use defines + #undef READ_OR_RETURN + #undef CMP_OR_RETURN - //================================================================= - void TileAssembler::getModelPosition(std::string& pPosString, ModelPosition& pModelPosition) + if(vectorarray != 0) + { + delete vectorarray; + } + + if(gtree->size() >0) + { + gtree->balance(); + SubModel *sm = new SubModel(gtree); + #ifdef _ASSEMBLER_DEBUG + if(::g_df) fprintf(::g_df,"group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); + if(sm->getNTriangles() != gtree->memberTable.size()) { - float vposarray[3]; - float vdirarray[3]; - float scale; + if(::g_df) fprintf(::g_df,"ERROR !!!! group trianglies: %d, Tris: %d, Nodes: %d, gtree.triangles: %d\n", g, sm->getNTriangles(), sm->getNNodes(), gtree->memberTable.size()); + } + #endif + sm->setBasePosition(pModelPosition.iPos); + pMainTree->insert(sm); + } + delete gtree; + } + fclose(rf); + return true; + } + + //================================================================= - size_t spos = pPosString.find_first_of('#'); - std::string stripedPosString = pPosString.substr(spos+1,pPosString.length()); + bool TileAssembler::fillModelIntoTree(AABSPTree<SubModel *> *pMainTree, const Vector3& pBasePos, std::string& pPos, std::string& pModelFilename) + { + ModelPosition modelPosition; + getModelPosition(pPos, modelPosition); + // all should be relative to object base position + modelPosition.moveToBasePos(pBasePos); - sscanf(stripedPosString.c_str(), "%f,%f,%f_%f,%f,%f_%f", - &vposarray[0],&vposarray[1],&vposarray[2], - &vdirarray[0],&vdirarray[1],&vdirarray[2], - &scale); + modelPosition.init(); - pModelPosition.iPos = Vector3(vposarray[0], vposarray[1], vposarray[2]); - pModelPosition.iDir = Vector3(vdirarray[0], vdirarray[1], vdirarray[2]); - pModelPosition.iScale = scale; + return readRawFile(pModelFilename, modelPosition, pMainTree); + } - } - //========================================== + //================================================================= + void TileAssembler::getModelPosition(std::string& pPosString, ModelPosition& pModelPosition) + { + float vposarray[3]; + float vdirarray[3]; + float scale; + + size_t spos = pPosString.find_first_of('#'); + std::string stripedPosString = pPosString.substr(spos+1,pPosString.length()); - } // VMAP + sscanf(stripedPosString.c_str(), "%f,%f,%f_%f,%f,%f_%f", + &vposarray[0],&vposarray[1],&vposarray[2], + &vdirarray[0],&vdirarray[1],&vdirarray[2], + &scale); + pModelPosition.iPos = Vector3(vposarray[0], vposarray[1], vposarray[2]); + pModelPosition.iDir = Vector3(vdirarray[0], vdirarray[1], vdirarray[2]); + pModelPosition.iScale = scale; + + } + //========================================== +} // VMAP |