diff options
91 files changed, 881 insertions, 890 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 003c9ac9d1c..9c666e7de32 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -438,7 +438,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false if (WaypointList.empty()) { - sLog->outError(LOG_FILTER_SQL, "TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", + sLog->outError(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).", me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0); return; } diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 1e83c203553..ebb734156b4 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -116,7 +116,7 @@ void FollowerAI::MoveInLineOfSight(Unit* who) } } -void FollowerAI::JustDied(Unit* /*pKiller*/) +void FollowerAI::JustDied(Unit* /*killer*/) { if (!HasFollowState(STATE_FOLLOW_INPROGRESS) || !m_uiLeaderGUID || !m_pQuestForFollow) return; @@ -305,7 +305,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); - sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName(), m_uiLeaderGUID); + sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID); } Player* FollowerAI::GetLeaderForFollower() diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 6097edf6641..462868a6e68 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -46,13 +46,13 @@ class TrinityStringTextBuilder size_t operator()(WorldPacket* data, LocaleConstant locale) const { std::string text = sObjectMgr->GetTrinityString(_textId, locale); - char const* localizedName = _source->GetNameForLocaleIdx(locale); + std::string localizedName = _source->GetNameForLocaleIdx(locale); *data << uint8(_msgType); *data << uint32(_language); *data << uint64(_source->GetGUID()); *data << uint32(1); // 2.1.0 - *data << uint32(strlen(localizedName)+1); + *data << uint32(localizedName.size() + 1); *data << localizedName; size_t whisperGUIDpos = data->wpos(); *data << uint64(_targetGUID); // Unit Target @@ -154,7 +154,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u mLastInvoker = unit->GetGUID(); if (Unit* tempInvoker = GetLastInvoker()) - sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName(), tempInvoker->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow()); switch (e.GetActionType()) { @@ -198,7 +198,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u mUseTextTimer = true; sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID); sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textGuid: %u", - talker->GetName(), talker->GetGUIDLow(), GUID_LOPART(mTextGUID)); + talker->GetName().c_str(), talker->GetGUIDLow(), GUID_LOPART(mTextGUID)); break; } case SMART_ACTION_SIMPLE_TALK: @@ -216,7 +216,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, (*itr)->ToPlayer()); } sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u", - (*itr)->GetName(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID)); + (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID)); } delete targets; @@ -234,7 +234,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { (*itr)->ToUnit()->HandleEmoteCommand(e.action.emote.emote); sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u", - (*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.emote.emote); + (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.emote.emote); } } @@ -253,7 +253,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { (*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.range > 0 ? true : false); sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u", - (*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range); + (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range); } } @@ -366,14 +366,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsPlayer(*itr)) - { if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest)) { (*itr)->ToPlayer()->AddQuest(q, NULL); sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u", (*itr)->GetGUIDLow(), e.action.quest.quest); } - } } delete targets; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index fe4bbea34fb..0ee133edce9 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -690,10 +690,10 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) guild->BroadcastWorker(say_do, GetPlayer()); } - if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL|ACHIEVEMENT_FLAG_REALM_FIRST_REACH)) + if (achievement->flags & (ACHIEVEMENT_FLAG_REALM_FIRST_KILL | ACHIEVEMENT_FLAG_REALM_FIRST_REACH)) { // broadcast realm first reached - WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, strlen(GetPlayer()->GetName())+1+8+4+4); + WorldPacket data(SMSG_SERVER_FIRST_ACHIEVEMENT, GetPlayer()->GetName().size() + 1 + 8 + 4 + 4); data << GetPlayer()->GetName(); data << uint64(GetPlayer()->GetGUID()); data << uint32(achievement->ID); diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index a0789040e9a..a595c73c7c0 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -44,7 +44,6 @@ void LoadFromDB() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!"); - return; } @@ -64,7 +63,6 @@ void LoadFromDB() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void SaveAddon(AddonInfo const& addon) diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h index fd227b258c5..9efbabc8b9f 100755 --- a/src/server/game/Addons/AddonMgr.h +++ b/src/server/game/Addons/AddonMgr.h @@ -25,7 +25,8 @@ struct AddonInfo { AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey) - : Name(name), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) {} + : Name(name), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) + { } std::string Name; uint8 Enabled; @@ -56,4 +57,3 @@ namespace AddonMgr } #endif - diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index e88c501398e..f84d38ed1b5 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -36,8 +36,7 @@ ArenaTeam::ArenaTeam() } ArenaTeam::~ArenaTeam() -{ -} +{ } bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) { @@ -284,14 +283,15 @@ void ArenaTeam::SetCaptain(uint64 guid) CharacterDatabase.Execute(stmt); // Enable remove/promote buttons - Player* newCaptain = ObjectAccessor::FindPlayer(guid); - if (newCaptain) + if (Player* newCaptain = ObjectAccessor::FindPlayer(guid)) { newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); - char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : ""; - uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0; - sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", - oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType()); + if (oldCaptain) + { + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", + oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(), + newCaptain->GetGUIDLow(), GetId(), GetType()); + } } } @@ -299,13 +299,11 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) { // Remove member from team for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr) - { if (itr->Guid == guid) { Members.erase(itr); break; } - } // Inform player and remove arena team info from player data if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -314,7 +312,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb) // delete all info regarding this team for (uint32 i = 0; i < ARENA_TEAM_END; ++i) player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0); - sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId()); } // Only used for single member deletion, for arena team disband we use a single query for more efficiency @@ -336,10 +334,10 @@ void ArenaTeam::Disband(WorldSession* session) // Broadcast update if (session) { - BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), ""); + BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName().c_str(), GetName(), ""); if (Player* player = session->GetPlayer()) - sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId()); + sLog->outDebug(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId()); } // Update database diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 963fd5e2d07..50f8554d5db 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -320,7 +320,7 @@ inline void Battleground::_CheckSafePositions(uint32 diff) GetTeamStartLoc(player->GetBGTeam(), x, y, z, o); if (pos.GetExactDistSq(x, y, z) > maxDist) { - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", player->GetName(), GetMapId()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", player->GetName().c_str(), GetMapId()); player->TeleportTo(GetMapId(), x, y, z, o); } } @@ -786,7 +786,12 @@ void Battleground::EndBattleground(uint32 winner) if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO)) for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(itr->first)) - sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); + { + sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", + m_ArenaType, player->GetName().c_str(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), + player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, + itr->second->KillingBlows); + } } // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes else @@ -1059,7 +1064,7 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (Transport) player->TeleportToBGEntryPoint(); - sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Removed player %s from Battleground.", player->GetName()); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Removed player %s from Battleground.", player->GetName().c_str()); } //battleground object will be deleted next Battleground::Update() call @@ -1200,7 +1205,7 @@ void Battleground::AddPlayer(Player* player) AddOrSetPlayerToCorrectBgGroup(player, team); // Log - sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Player %s joined the battle.", player->GetName()); + sLog->outInfo(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Player %s joined the battle.", player->GetName().c_str()); } // this method adds player to his team's bg group, or sets his correct group if player is already in bg group diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index a787f4b6810..bfa3b955427 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -873,11 +873,11 @@ void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, Batt team = player->GetTeam(); bg->GetTeamStartLoc(team, x, y, z, O); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName(), mapid, x, y, z, O, bgTypeId); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Sending %s to map %u, X %f, Y %f, Z %f, O %f (bgType %u)", player->GetName().c_str(), mapid, x, y, z, O, bgTypeId); player->TeleportTo(mapid, x, y, z, O); } else - sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName()); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr::SendToBattleground: Instance %u (bgType %u) not found while trying to teleport player %s", instanceId, bgTypeId, player->GetName().c_str()); } void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid) diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index aa4177eaf51..922cccb9186 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -476,7 +476,7 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: invited player %s (%u) to BG instance %u queueindex %u bgtype %u, I can't help it if they don't press the enter battle button.", - player->GetName(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID()); + player->GetName().c_str(), player->GetGUIDLow(), bg->GetInstanceID(), queueSlot, bg->GetTypeID()); // send status packet sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index ee25f72b382..e900bc9b1d3 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -648,9 +648,9 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (Source->GetTeam() == ALLIANCE) - PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName()); + PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName().c_str()); else - PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName()); + PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName().c_str()); } void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point) diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 579f322594a..66f964fb4cf 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -24,8 +24,9 @@ #include "DatabaseEnv.h" #include "AccountMgr.h" -Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) - : m_announce(true), m_ownership(true), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id), m_ownerGUID(0), m_Team(Team) +Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_announce(true), + m_ownership(true), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id), + m_ownerGUID(0), m_Team(Team) { m_IsSaved = false; // set special flags if built-in channel @@ -70,10 +71,9 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) if (db_BannedList) { Tokenizer tokens(db_BannedList, ' '); - Tokenizer::const_iterator iter; - for (iter = tokens.begin(); iter != tokens.end(); ++iter) + for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i) { - uint64 banned_guid = atol(*iter); + uint64 banned_guid = atol(*i); if (banned_guid) { sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) loaded banned guid:" UI64FMTD "", name.c_str(), banned_guid); @@ -118,7 +118,6 @@ void Channel::UpdateChannelInDB() const sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", m_name.c_str()); } - } void Channel::UpdateChannelUseageInDB() const diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index 04bb4ae2916..6794a4ea93b 100755 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -246,7 +246,7 @@ class Channel public: uint32 m_Team; Channel(const std::string& name, uint32 channel_id, uint32 Team = 0); - std::string GetName() const { return m_name; } + std::string const& GetName() const { return m_name; } uint32 GetChannelId() const { return m_channelId; } bool IsConstant() const { return m_channelId != 0; } bool IsAnnounce() const { return m_announce; } diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 75436e1eb5f..78b71744e0e 100755 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -20,7 +20,15 @@ #include "World.h" -ChannelMgr* channelMgr(uint32 team) +ChannelMgr::~ChannelMgr() +{ + for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr) + delete itr->second; + + channels.clear(); +} + +ChannelMgr* ChannelMgr::forTeam(uint32 team) { if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction @@ -33,31 +41,25 @@ ChannelMgr* channelMgr(uint32 team) return NULL; } -ChannelMgr::~ChannelMgr() -{ - for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr) - delete itr->second; - - channels.clear(); -} - -Channel* ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) +Channel* ChannelMgr::GetJoinChannel(std::string const& name, uint32 channel_id) { std::wstring wname; Utf8toWStr(name, wname); wstrToLower(wname); - if (channels.find(wname) == channels.end()) + ChannelMap::const_iterator i = channels.find(wname); + + if (i == channels.end()) { Channel* nchan = new Channel(name, channel_id, team); channels[wname] = nchan; return nchan; } - return channels[wname]; + return i->second; } -Channel* ChannelMgr::GetChannel(std::string name, Player* p, bool pkt) +Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pkt) { std::wstring wname; Utf8toWStr(name, wname); @@ -71,7 +73,7 @@ Channel* ChannelMgr::GetChannel(std::string name, Player* p, bool pkt) { WorldPacket data; MakeNotOnPacket(&data, name); - p->GetSession()->SendPacket(&data); + player->GetSession()->SendPacket(&data); } return NULL; @@ -80,7 +82,7 @@ Channel* ChannelMgr::GetChannel(std::string name, Player* p, bool pkt) return i->second; } -void ChannelMgr::LeftChannel(std::string name) +void ChannelMgr::LeftChannel(std::string const& name) { std::wstring wname; Utf8toWStr(name, wname); @@ -100,7 +102,7 @@ void ChannelMgr::LeftChannel(std::string name) } } -void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string name) +void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name) { data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size (*data) << (uint8)0x05 << name; diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index 887e53f49a5..c1d1793c446 100755 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -29,23 +29,29 @@ class ChannelMgr { + typedef std::map<std::wstring, Channel*> ChannelMap; + public: - uint32 team; - typedef std::map<std::wstring, Channel*> ChannelMap; - ChannelMgr() {team = 0;} + ChannelMgr() : team(0) + { } + ~ChannelMgr(); - Channel* GetJoinChannel(std::string name, uint32 channel_id); - Channel* GetChannel(std::string name, Player* p, bool pkt = true); - void LeftChannel(std::string name); + static ChannelMgr * forTeam(uint32 team); + void setTeam(uint32 newTeam) { team = newTeam; } + + Channel* GetJoinChannel(std::string const& name, uint32 channel_id); + Channel* GetChannel(std::string const& name, Player* p, bool pkt = true); + void LeftChannel(std::string const& name); + private: ChannelMap channels; - void MakeNotOnPacket(WorldPacket* data, std::string name); + uint32 team; + + void MakeNotOnPacket(WorldPacket* data, std::string const& name); }; class AllianceChannelMgr : public ChannelMgr {}; class HordeChannelMgr : public ChannelMgr {}; -ChannelMgr* channelMgr(uint32 team); - #endif diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index b5bad419c98..88c3de274fb 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -350,8 +350,8 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, co Player* p = m_session->GetPlayer(); uint64 sel_guid = p->GetSelection(); sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected %s: %s (GUID: %u)]", - fullcmd.c_str(), p->GetName(), m_session->GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(), - GetLogNameForGuid(sel_guid), (p->GetSelectedUnit()) ? p->GetSelectedUnit()->GetName() : "", GUID_LOPART(sel_guid)); + fullcmd.c_str(), p->GetName().c_str(), m_session->GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(), + GetLogNameForGuid(sel_guid), (p->GetSelectedUnit()) ? p->GetSelectedUnit()->GetName().c_str() : "", GUID_LOPART(sel_guid)); } } } @@ -370,7 +370,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, co return false; } -bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand) +bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, char const* text, uint32 security, std::string const& help, std::string const& fullcommand) { std::string cmd = ""; @@ -425,7 +425,7 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text, return false; } -int ChatHandler::ParseCommands(const char* text) +int ChatHandler::ParseCommands(char const* text) { ASSERT(text); ASSERT(*text); @@ -465,7 +465,7 @@ int ChatHandler::ParseCommands(const char* text) return 1; } -bool ChatHandler::isValidChatMessage(const char* message) +bool ChatHandler::isValidChatMessage(char const* message) { /* Valid examples: @@ -663,7 +663,7 @@ void ChatHandler::FillMessageData(WorldPacket* data, WorldSession* session, uint { *data << uint64(speaker->GetGUID()); *data << uint32(0); // 2.1.0 - *data << uint32(strlen(speaker->GetName()) + 1); + *data << uint32(speaker->GetName().size() + 1); *data << speaker->GetName(); uint64 listener_guid = 0; *data << uint64(listener_guid); @@ -1020,7 +1020,7 @@ uint64 ChatHandler::extractGuidFromLink(char* text) if (!normalizePlayerName(name)) return 0; - if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str())) + if (Player* player = sObjectAccessor->FindPlayerByName(name)) return player->GetGUID(); if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(name)) @@ -1078,7 +1078,7 @@ bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* playe return false; } - Player* pl = sObjectAccessor->FindPlayerByName(name.c_str()); + Player* pl = sObjectAccessor->FindPlayerByName(name); // if allowed player pointer if (player) @@ -1213,7 +1213,7 @@ bool ChatHandler::GetPlayerGroupAndGUIDByName(const char* cname, Player* &player return false; } - player = sObjectAccessor->FindPlayerByName(name.c_str()); + player = sObjectAccessor->FindPlayerByName(name); if (offline) guid = sObjectMgr->GetPlayerGUIDByName(name.c_str()); } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 7b609220c30..72f00406c69 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -661,7 +661,7 @@ ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint CreatureSpellConditionContainer::const_iterator itr = VehicleSpellConditionStore.find(creatureId); if (itr != VehicleSpellConditionStore.end()) { - ConditionTypeContainer::const_iterator i = (*itr).second.find(spellId); + ConditionTypeContainer::const_iterator i = (*itr).second.find(spellId); if (i != (*itr).second.end()) { cond = (*i).second; diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 9b065729b88..a209d9b6cf6 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -60,7 +60,6 @@ void LoadDisables() if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!"); - return; } @@ -134,10 +133,12 @@ void LoadDisables() case MAP_INSTANCE: case MAP_RAID: if (flags & DUNGEON_STATUSFLAG_HEROIC && !GetMapDifficultyData(entry, DUNGEON_DIFFICULTY_HEROIC)) - isFlagInvalid = true; - else if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC)) - isFlagInvalid = true; - else if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC)) + flags -= DUNGEON_STATUSFLAG_HEROIC; + if (flags & RAID_STATUSFLAG_10MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_10MAN_HEROIC)) + flags -= RAID_STATUSFLAG_10MAN_HEROIC; + if (flags & RAID_STATUSFLAG_25MAN_HEROIC && !GetMapDifficultyData(entry, RAID_DIFFICULTY_25MAN_HEROIC)) + flags -= RAID_STATUSFLAG_25MAN_HEROIC; + if (!flags) isFlagInvalid = true; break; case MAP_BATTLEGROUND: @@ -229,7 +230,6 @@ void LoadDisables() while (result->NextRow()); sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime)); - } void CheckQuestDisables() @@ -240,7 +240,6 @@ void CheckQuestDisables() if (!count) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables."); - return; } @@ -260,7 +259,6 @@ void CheckQuestDisables() } sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index a1084e8807e..25c6b25676e 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1394,7 +1394,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* if (out) { sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported out. Current Map %u - Expected Map %u", - player->GetName(), player->GetMapId(), uint32(dungeon->map)); + player->GetName().c_str(), player->GetMapId(), uint32(dungeon->map)); if (player->GetMapId() == uint32(dungeon->map)) { player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); @@ -1466,7 +1466,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* player->GetSession()->SendLfgTeleportError(uint8(error)); sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported in. Result: %u", - player->GetName(), error); + player->GetName().c_str(), error); } /** diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 9359581e3a0..bbee663c955 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -79,7 +79,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner) if (!IsPositionValid()) { sLog->outError(LOG_FILTER_PLAYER, "Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)", - guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY()); + guidlow, owner->GetName().c_str(), owner->GetPositionX(), owner->GetPositionY()); return false; } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 305168881a5..9bcd4d9c1e2 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1601,7 +1601,8 @@ void Creature::Respawn(bool force) if (m_DBTableGuid) GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid); - sLog->outDebug(LOG_FILTER_UNITS, "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName(), GetGUIDLow(), GetGUID(), GetEntry()); + sLog->outDebug(LOG_FILTER_UNITS, "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", + GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry()); m_respawnTime = 0; lootForPickPocketed = false; lootForBody = false; @@ -2443,7 +2444,7 @@ TrainerSpellData const* Creature::GetTrainerSpells() const } // overwrite WorldObject function for proper name localization -const char* Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const +std::string const & Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const { if (loc_idx != DEFAULT_LOCALE) { @@ -2452,7 +2453,7 @@ const char* Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const if (cl) { if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty()) - return cl->Name[uloc_idx].c_str(); + return cl->Name[uloc_idx]; } } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index b9fb5c8831c..2c711b9efe6 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -584,7 +584,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId, language, TargetGuid); } // override WorldObject function for proper name localization - const char* GetNameForLocaleIdx(LocaleConstant locale_idx) const; + std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const; void setDeathState(DeathState s); // override virtual Unit::setDeathState diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index ec196280d99..17a8711379a 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -142,9 +142,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const data << uint32(_questMenu.GetMenuItemCount()); // max count 0x20 - for (uint32 iI = 0; iI < _questMenu.GetMenuItemCount(); ++iI) + for (uint8 i = 0; i < _questMenu.GetMenuItemCount(); ++i) { - QuestMenuItem const& item = _questMenu.GetItem(iI); + QuestMenuItem const& item = _questMenu.GetItem(i); uint32 questID = item.QuestId; Quest const* quest = sObjectMgr->GetQuestTemplate(questID); @@ -155,7 +155,7 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation std::string title = quest->GetTitle(); - int locale = _session->GetSessionDbLocaleIndex(); + int32 locale = _session->GetSessionDbLocaleIndex(); if (locale >= 0) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) ObjectMgr::GetLocaleString(localeData->Title, locale, title); @@ -262,10 +262,10 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title { std::string title = quest->GetTitle(); - int loc_idx = _session->GetSessionDbLocaleIndex(); - if (loc_idx >= 0) - if (QuestLocale const* ql = sObjectMgr->GetQuestLocale(questID)) - ObjectMgr::GetLocaleString(ql->Title, loc_idx, title); + int32 locale = _session->GetSessionDbLocaleIndex(); + if (locale >= 0) + if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) + ObjectMgr::GetLocaleString(localeData->Title, locale, title); data << uint32(questID); data << uint32(qmi.QuestIcon); @@ -405,7 +405,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const std::string questCompletedText = quest->GetCompletedText(); std::string questObjectiveText[QUEST_OBJECTIVES_COUNT]; - for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) questObjectiveText[i] = quest->ObjectiveText[i]; int32 locale = _session->GetSessionDbLocaleIndex(); @@ -419,7 +419,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const ObjectMgr::GetLocaleString(localeData->EndText, locale, questEndText); ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText); - for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]); } } @@ -466,46 +466,46 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const if (quest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) { - for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) + for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) data << uint32(0) << uint32(0); - for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) + for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) data << uint32(0) << uint32(0); } else { - for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i) + for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i) { data << uint32(quest->RewardItemId[i]); data << uint32(quest->RewardItemIdCount[i]); } - for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) + for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { data << uint32(quest->RewardChoiceItemId[i]); data << uint32(quest->RewardChoiceItemCount[i]); } } - for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids + for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids data << uint32(quest->RewardFactionId[i]); - for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc? + for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid+1 QuestFactionReward.dbc? data << int32(quest->RewardFactionValueId[i]); - for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0) + for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // unk (0) data << int32(quest->RewardFactionValueIdOverride[i]); - data << quest->GetPointMapId(); - data << quest->GetPointX(); - data << quest->GetPointY(); - data << quest->GetPointOpt(); + data << uint32(quest->GetPointMapId()); + data << float(quest->GetPointX()); + data << float(quest->GetPointY()); + data << uint32(quest->GetPointOpt()); data << questTitle; data << questObjectives; data << questDetails; data << questEndText; - data << questCompletedText; // display in quest objectives window once all objectives are completed + data << questCompletedText; // display in quest objectives window once all objectives are completed - for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { if (quest->RequiredNpcOrGo[i] < 0) data << uint32((quest->RequiredNpcOrGo[i] * (-1)) | 0x80000000); // client expects gameobject template id in form (id|0x80000000) @@ -517,13 +517,13 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << uint32(0); // req source count? } - for (uint32 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) { data << uint32(quest->RequiredItemId[i]); data << uint32(quest->RequiredItemCount[i]); } - for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) data << questObjectiveText[i]; _session->SendPacket(&data); @@ -535,7 +535,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b std::string questTitle = quest->GetTitle(); std::string questOfferRewardText = quest->GetOfferRewardText(); - int locale = _session->GetSessionDbLocaleIndex(); + int32 locale = _session->GetSessionDbLocaleIndex(); if (locale >= 0) { if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) @@ -556,7 +556,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b data << uint32(quest->GetSuggestedPlayers()); // SuggestedGroupNum uint32 emoteCount = 0; - for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i) + for (uint8 i = 0; i < QUEST_EMOTE_COUNT; ++i) { if (quest->OfferRewardEmote[i] <= 0) break; @@ -564,7 +564,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b } data << emoteCount; // Emote Count - for (uint32 i = 0; i < emoteCount; ++i) + for (uint8 i = 0; i < emoteCount; ++i) { data << uint32(quest->OfferRewardEmoteDelay[i]); // Delay Emote data << uint32(quest->OfferRewardEmote[i]); @@ -651,7 +651,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, data << questTitle; data << requestItemsText; - data << uint32(0x00); // unknown + data << uint32(0); // unknown if (canComplete) data << quest->GetCompleteEmote(); @@ -659,10 +659,7 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, data << quest->GetIncompleteEmote(); // Close Window after cancel - if (closeOnCancel) - data << uint32(0x01); - else - data << uint32(0x00); + data << uint32(closeOnCancel); data << uint32(quest->GetFlags()); // 3.3.3 questFlags data << uint32(quest->GetSuggestedPlayers()); // SuggestedGroupNum diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index ee85cbbc301..3b3120d1cf9 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -33,7 +33,7 @@ #include "GameObjectModel.h" #include "DynamicTree.h" -GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new GameObjectValue), m_AI(NULL) +GameObject::GameObject(): WorldObject(false), m_model(NULL), m_goValue(), m_AI(NULL) { m_objectType |= TYPEMASK_GAMEOBJECT; m_objectTypeId = TYPEID_GAMEOBJECT; @@ -65,7 +65,6 @@ GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new Game GameObject::~GameObject() { - delete m_goValue; delete m_AI; delete m_model; //if (m_uint32Values) // field array can be not exist if GameOBject not loaded @@ -226,8 +225,8 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa switch (goinfo->type) { case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING: - m_goValue->Building.Health = goinfo->building.intactNumHits + goinfo->building.damagedNumHits; - m_goValue->Building.MaxHealth = m_goValue->Building.Health; + m_goValue.Building.Health = goinfo->building.intactNumHits + goinfo->building.damagedNumHits; + m_goValue.Building.MaxHealth = m_goValue.Building.Health; SetGoAnimProgress(255); break; case GAMEOBJECT_TYPE_TRANSPORT: @@ -1642,7 +1641,7 @@ void GameObject::Use(Unit* user) default: if (GetGoType() >= MAX_GAMEOBJECT_TYPE) sLog->outError(LOG_FILTER_GENERAL, "GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", - user->GetTypeId(), user->GetGUIDLow(), user->GetName(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType()); + user->GetTypeId(), user->GetGUIDLow(), user->GetName().c_str(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType()); break; } @@ -1756,14 +1755,14 @@ void GameObject::EventInform(uint32 eventId) } // overwrite WorldObject function for proper name localization -const char* GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const +std::string const & GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const { if (loc_idx != DEFAULT_LOCALE) { uint8 uloc_idx = uint8(loc_idx); if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry())) if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty()) - return cl->Name[uloc_idx].c_str(); + return cl->Name[uloc_idx]; } return GetName(); @@ -1801,22 +1800,22 @@ void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, uint32 spellId /*= 0*/) { - if (!GetGOValue()->Building.MaxHealth || !change) + if (!m_goValue.Building.MaxHealth || !change) return; // prevent double destructions of the same object - if (change < 0 && !GetGOValue()->Building.Health) + if (change < 0 && !m_goValue.Building.Health) return; - if (int32(GetGOValue()->Building.Health) + change <= 0) - GetGOValue()->Building.Health = 0; - else if (int32(GetGOValue()->Building.Health) + change >= int32(GetGOValue()->Building.MaxHealth)) - GetGOValue()->Building.Health = GetGOValue()->Building.MaxHealth; + if (int32(m_goValue.Building.Health) + change <= 0) + m_goValue.Building.Health = 0; + else if (int32(m_goValue.Building.Health) + change >= int32(m_goValue.Building.MaxHealth)) + m_goValue.Building.Health = m_goValue.Building.MaxHealth; else - GetGOValue()->Building.Health += change; + m_goValue.Building.Health += change; // Set the health bar, value = 255 * healthPct; - SetGoAnimProgress(GetGOValue()->Building.Health * 255 / GetGOValue()->Building.MaxHealth); + SetGoAnimProgress(m_goValue.Building.Health * 255 / m_goValue.Building.MaxHealth); Player* player = attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself(); @@ -1835,11 +1834,11 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u GameObjectDestructibleState newState = GetDestructibleState(); - if (!GetGOValue()->Building.Health) + if (!m_goValue.Building.Health) newState = GO_DESTRUCTIBLE_DESTROYED; - else if (GetGOValue()->Building.Health <= GetGOInfo()->building.damagedNumHits) + else if (m_goValue.Building.Health <= GetGOInfo()->building.damagedNumHits) newState = GO_DESTRUCTIBLE_DAMAGED; - else if (GetGOValue()->Building.Health == GetGOValue()->Building.MaxHealth) + else if (m_goValue.Building.Health == m_goValue.Building.MaxHealth) newState = GO_DESTRUCTIBLE_INTACT; if (newState == GetDestructibleState()) @@ -1860,7 +1859,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* SetDisplayId(m_goInfo->displayId); if (setHealth) { - m_goValue->Building.Health = m_goValue->Building.MaxHealth; + m_goValue.Building.Health = m_goValue.Building.MaxHealth; SetGoAnimProgress(255); } EnableCollision(true); @@ -1884,12 +1883,12 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (setHealth) { - m_goValue->Building.Health = m_goInfo->building.damagedNumHits; - uint32 maxHealth = m_goValue->Building.MaxHealth; + m_goValue.Building.Health = m_goInfo->building.damagedNumHits; + uint32 maxHealth = m_goValue.Building.MaxHealth; // in this case current health is 0 anyway so just prevent crashing here if (!maxHealth) maxHealth = 1; - SetGoAnimProgress(m_goValue->Building.Health * 255 / maxHealth); + SetGoAnimProgress(m_goValue.Building.Health * 255 / maxHealth); } break; } @@ -1917,7 +1916,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (setHealth) { - m_goValue->Building.Health = 0; + m_goValue.Building.Health = 0; SetGoAnimProgress(0); } EnableCollision(false); @@ -1937,7 +1936,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* // restores to full health if (setHealth) { - m_goValue->Building.Health = m_goValue->Building.MaxHealth; + m_goValue.Building.Health = m_goValue.Building.MaxHealth; SetGoAnimProgress(255); } EnableCollision(true); diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 8fb81a0e021..e441cede087 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -628,7 +628,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> static GameObject* GetGameObject(WorldObject& object, uint64 guid); GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } GameObjectData const* GetGOData() const { return m_goData; } - GameObjectValue * GetGOValue() const { return m_goValue; } + GameObjectValue const* GetGOValue() const { return &m_goValue; } bool IsTransport() const; bool IsDynTransport() const; @@ -645,7 +645,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId, language, TargetGuid); } // overwrite WorldObject function for proper name localization - const char* GetNameForLocaleIdx(LocaleConstant locale_idx) const; + std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const; void SaveToDB(); void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); @@ -826,7 +826,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid GameObjectTemplate const* m_goInfo; GameObjectData const* m_goData; - GameObjectValue * const m_goValue; + GameObjectValue m_goValue; uint64 m_rotation; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 8647e6ddb4f..d75ef9aabf2 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -92,7 +92,8 @@ WorldObject::~WorldObject() { if (GetTypeId() == TYPEID_CORPSE) { - sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry()); + sLog->outFatal(LOG_FILTER_GENERAL, "Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", + GetGUID(), ((Corpse*)this)->GetType(), GetEntry()); ASSERT(false); } ResetMap(); @@ -767,23 +768,6 @@ void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) cons BuildValuesUpdateBlockForPlayer(&iter->second, iter->first); } -void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 count) -{ - if (!data) - return; - - Tokenizer tokens(data, ' ', count); - - if (tokens.size() != count) - return; - - for (uint32 index = 0; index < count; ++index) - { - m_uint32Values[startOffset + index] = atol(tokens[index]); - _changedFields[startOffset + index] = true; - } -} - void Object::GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const { // This function assumes updatefield index is always valid @@ -844,6 +828,23 @@ bool Object::IsUpdateFieldVisible(uint32 flags, bool isSelf, bool isOwner, bool return false; } +void Object::_LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count) +{ + if (data.empty()) + return; + + Tokenizer tokens(data, ' ', count); + + if (tokens.size() != count) + return; + + for (uint32 index = 0; index < count; ++index) + { + m_uint32Values[startOffset + index] = atol(tokens[index]); + _changedFields[startOffset + index] = true; + } +} + void Object::_SetUpdateBits(UpdateMask* updateMask, Player* target) const { bool* indexes = _changedFields; @@ -2124,13 +2125,13 @@ void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisp player->GetSession()->SendPacket(&data); } -void WorldObject::BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 targetGuid) const +void WorldObject::BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, std::string const &name, uint64 targetGuid) const { *data << (uint8)msgtype; *data << (uint32)language; *data << (uint64)GetGUID(); *data << (uint32)0; // 2.1.0 - *data << (uint32)(strlen(name)+1); + *data << (uint32)(name.size()+1); *data << name; *data << (uint64)targetGuid; // Unit Target if (targetGuid && !IS_PLAYER_GUID(targetGuid)) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 410903f6619..a14bbe84945 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -51,7 +51,7 @@ enum TypeMask TYPEMASK_OBJECT = 0x0001, TYPEMASK_ITEM = 0x0002, TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004 - TYPEMASK_UNIT = 0x0008, // creature + TYPEMASK_UNIT = 0x0008, // creature TYPEMASK_PLAYER = 0x0010, TYPEMASK_GAMEOBJECT = 0x0020, TYPEMASK_DYNAMICOBJECT = 0x0040, @@ -325,7 +325,7 @@ class Object void _InitValues(); void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh); std::string _ConcatFields(uint16 startIndex, uint16 size) const; - void _LoadIntoDataField(const char* data, uint32 startOffset, uint32 count); + void _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count); void GetUpdateFieldData(Player const* target, uint32*& flags, bool& isOwner, bool& isItemOwner, bool& hasSpecialInfo, bool& isPartyMember) const; @@ -654,10 +654,10 @@ class WorldObject : public Object, public WorldLocation InstanceScript* GetInstanceScript(); - const char* GetName() const { return m_name.c_str(); } + std::string const& GetName() const { return m_name; } void SetName(const std::string& newname) { m_name=newname; } - virtual const char* GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return GetName(); } + virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; } float GetDistance(const WorldObject* obj) const { @@ -743,7 +743,7 @@ class WorldObject : public Object, public WorldLocation void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false); void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false); void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid); - void BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; + void BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, std::string const &name, uint64 TargetGuid) const; void PlayDistanceSound(uint32 sound_id, Player* target = NULL); void PlayDirectSound(uint32 sound_id, Player* target = NULL); diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h index a3c8901880f..03fa44da08a 100755 --- a/src/server/game/Entities/Object/ObjectDefines.h +++ b/src/server/game/Entities/Object/ObjectDefines.h @@ -122,4 +122,3 @@ inline char const* GetLogNameForGuid(uint64 guid) } } #endif - diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 283f2032ab0..d2d9bdac4b3 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -34,9 +34,9 @@ #define PET_XP_FACTOR 0.05f Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner, true), -m_usedTalentCount(0), m_removed(false), m_owner(owner), -m_happinessTimer(7500), m_petType(type), m_duration(0), -m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL) + m_usedTalentCount(0), m_removed(false), m_owner(owner), + m_happinessTimer(7500), m_petType(type), m_duration(0), + m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL) { m_unitTypeMask |= UNIT_MASK_PET; if (type == HUNTER_PET) @@ -77,7 +77,6 @@ void Pet::AddToWorld() GetCharmInfo()->SetIsFollowing(false); GetCharmInfo()->SetIsReturning(false); } - } void Pet::RemoveFromWorld() @@ -456,7 +455,7 @@ void Pet::SavePetToDB(PetSaveMode mode) for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i) { ss << uint32(m_charmInfo->GetActionBarEntry(i)->GetType()) << ' ' - << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' '; + << uint32(m_charmInfo->GetActionBarEntry(i)->GetAction()) << ' '; }; ss << "', " @@ -562,7 +561,7 @@ void Pet::Update(uint32 diff) { if (owner->GetPetGUID() != GetGUID()) { - sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName()); + sLog->outError(LOG_FILTER_PETS, "Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName().c_str()); Remove(getPetType() == HUNTER_PET?PET_SAVE_AS_DELETED:PET_SAVE_NOT_IN_SLOT); return; } @@ -2069,4 +2068,4 @@ void Pet::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) if (Player* owner = GetOwner()) owner->GetSession()->SendPacket(&data); -}
\ No newline at end of file +} diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 6e080263862..f55d03ce081 100755 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -225,7 +225,7 @@ class Pet : public Guardian bool m_removed; // prevent overwrite pet state in DB at next Pet::Update if pet already removed(saved) - Player* GetOwner() { return m_owner; } + Player* GetOwner() const { return m_owner; } protected: Player* m_owner; uint32 m_happinessTimer; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index eeb3a49c368..41976198ff6 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1753,7 +1753,7 @@ void Player::Update(uint32 p_time) { // m_nextSave reseted in SaveToDB call SaveToDB(); - sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName().c_str(), GetGUIDLow()); } else m_nextSave -= p_time; @@ -1842,7 +1842,7 @@ void Player::setDeathState(DeathState s) { if (!cur) { - sLog->outError(LOG_FILTER_PLAYER, "setDeathState: attempt to kill a dead player %s(%d)", GetName(), GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "setDeathState: attempt to kill a dead player %s(%d)", GetName().c_str(), GetGUIDLow()); return; } @@ -2088,13 +2088,13 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation)) { sLog->outError(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", - mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + mapid, x, y, z, orientation, GetGUIDLow(), GetName().c_str(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { - sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); + sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName().c_str(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); return false; } @@ -2112,7 +2112,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati // client without expansion support if (GetSession()->Expansion() < mEntry->Expansion()) { - sLog->outDebug(LOG_FILTER_MAPS, "Player %s using client without required expansion tried teleport to non accessible map %u", GetName(), mapid); + sLog->outDebug(LOG_FILTER_MAPS, "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid); if (GetTransport()) { @@ -2129,7 +2129,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; // normal client can't teleport to this map... } else - sLog->outDebug(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName(), mapid); + sLog->outDebug(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName().c_str(), mapid); if (m_vehicle) ExitVehicle(); @@ -2451,7 +2451,8 @@ void Player::RemoveFromWorld() { if (WorldObject* viewpoint = GetViewpoint()) { - sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); + sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", + GetName().c_str(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); } } @@ -2776,7 +2777,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes return go; sLog->outDebug(LOG_FILTER_MAPS, "IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(), - go->GetGUIDLow(), GetName(), GetGUIDLow(), go->GetDistance(this)); + go->GetGUIDLow(), GetName().c_str(), GetGUIDLow(), go->GetDistance(this)); } } return NULL; @@ -5077,7 +5078,7 @@ void Player::BuildPlayerRepop() // the player cannot have a corpse already, only bones which are not returned by GetCorpse if (GetCorpse()) { - sLog->outError(LOG_FILTER_PLAYER, "BuildPlayerRepop: player %s(%d) already has a corpse", GetName(), GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "BuildPlayerRepop: player %s(%d) already has a corpse", GetName().c_str(), GetGUIDLow()); return; } @@ -5086,7 +5087,7 @@ void Player::BuildPlayerRepop() Corpse* corpse = GetCorpse(); if (!corpse) { - sLog->outError(LOG_FILTER_PLAYER, "Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Error creating corpse for Player %s [%u]", GetName().c_str(), GetGUIDLow()); return; } GetMap()->AddToMap(corpse); @@ -5579,7 +5580,7 @@ void Player::CleanupChannels() Channel* ch = *m_channels.begin(); m_channels.erase(m_channels.begin()); // remove from player's channel list ch->Leave(GetGUID(), false); // not send to client, not remove from player's channel list - if (ChannelMgr* cMgr = channelMgr(GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam())) cMgr->LeftChannel(ch->GetName()); // deleted channel if empty } sLog->outDebug(LOG_FILTER_CHATSYS, "Player: channels cleaned up!"); @@ -5594,7 +5595,7 @@ void Player::UpdateLocalChannels(uint32 newZone) if (!current_zone) return; - ChannelMgr* cMgr = channelMgr(GetTeam()); + ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam()); if (!cMgr) return; @@ -5782,7 +5783,7 @@ void Player::GetDodgeFromAgility(float &diminishing, float &nondiminishing) const float dodge_base[MAX_CLASSES] = { 0.036640f, // Warrior - 0.034943f, // Paladi + 0.034943f, // Paladin -0.040873f, // Hunter 0.020957f, // Rogue 0.034178f, // Priest @@ -6650,13 +6651,13 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS); + sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTONS ); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE); + sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6665,25 +6666,31 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - sLog->outError(LOG_FILTER_PLAYER_LOADING, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName().c_str()); return false; } if (!HasSpell(action)) { - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::IsActionButtonDataValid Spell action %u not added into button %u for player %s: player don't known this spell", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: player don't known this spell", action, button, GetName().c_str()); return false; } break; case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - sLog->outError(LOG_FILTER_PLAYER_LOADING, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName()); + sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName().c_str()); return false; } break; + case ACTION_BUTTON_C: + case ACTION_BUTTON_CMACRO: + case ACTION_BUTTON_MACRO: + case ACTION_BUTTON_EQSET: + break; default: - break; // other cases not checked at this moment + sLog->outError(LOG_FILTER_PLAYER, "Unknown action type %u", type); + return false; // other cases not checked at this moment } return true; @@ -6700,7 +6707,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) // set data and update to CHANGED if not NEW ab.SetActionAndType(action, ActionButtonType(type)); - sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); + sLog->outDebug(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); return &ab; } @@ -6715,7 +6722,7 @@ void Player::removeActionButton(uint8 button) else buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save - sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); } ActionButton const* Player::GetActionButton(uint8 button) @@ -7103,21 +7110,21 @@ void Player::UpdateHonorFields() ///Calculate the amount of honor gained based on the victim ///and the size of the group for which the honor is divided ///An exact honor value can also be given (overriding the calcs) -bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvptoken) +bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvptoken) { // do not reward honor in arenas, but enable onkill spellproc if (InArena()) { - if (!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER) + if (!victim || victim == this || victim->GetTypeId() != TYPEID_PLAYER) return false; - if (GetBGTeam() == uVictim->ToPlayer()->GetBGTeam()) + if (GetBGTeam() == victim->ToPlayer()->GetBGTeam()) return false; return true; } - // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens + // 'Inactive' this aura prevents the player from gaining honor points and battleground Tokenizer if (HasAura(SPELL_AURA_PLAYER_INACTIVE)) return false; @@ -7136,16 +7143,14 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt if (honor_f <= 0) { - if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) + if (!victim || victim == this || victim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) return false; - victim_guid = uVictim->GetGUID(); + victim_guid = victim->GetGUID(); - if (uVictim->GetTypeId() == TYPEID_PLAYER) + if (Player* plrVictim = victim->ToPlayer()) { - Player* victim = uVictim->ToPlayer(); - - if (GetTeam() == victim->GetTeam() && !sWorld->IsFFAPvPRealm()) + if (GetTeam() == plrVictim->GetTeam() && !sWorld->IsFFAPvPRealm()) return false; uint8 k_level = getLevel(); @@ -7190,7 +7195,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt } else { - if (!uVictim->ToCreature()->isRacialLeader()) + if (!victim->ToCreature()->isRacialLeader()) return false; honor_f = 100.0f; // ??? need more info @@ -7198,7 +7203,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt } } - if (uVictim != NULL) + if (victim != NULL) { if (groupsize > 1) honor_f /= groupsize; @@ -7216,9 +7221,9 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt // victim_rank [5..19] HK: <alliance\horde rank> // victim_rank [0, 20+] HK: <> WorldPacket data(SMSG_PVP_CREDIT, 4+8+4); - data << honor; - data << victim_guid; - data << victim_rank; + data << uint32(honor); + data << uint64(victim_guid); + data << uint32(victim_rank); GetSession()->SendPacket(&data); @@ -7237,10 +7242,10 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvpt if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE) && pvptoken) { - if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) + if (!victim || victim == this || victim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT)) return true; - if (uVictim->GetTypeId() == TYPEID_PLAYER) + if (victim->GetTypeId() == TYPEID_PLAYER) { // Check if allowed to receive it in current map uint8 MapType = sWorld->getIntConfig(CONFIG_PVP_TOKEN_MAP_TYPE); @@ -7597,7 +7602,7 @@ void Player::DuelComplete(DuelCompleteType type) if (!duel) return; - sLog->outDebug(LOG_FILTER_UNITS, "Duel Complete %s %s", GetName(), duel->opponent->GetName()); + sLog->outDebug(LOG_FILTER_UNITS, "Duel Complete %s %s", GetName().c_str(), duel->opponent->GetName().c_str()); WorldPacket data(SMSG_DUEL_COMPLETE, (1)); data << (uint8)((type != DUEL_INTERRUPTED) ? 1 : 0); @@ -8386,7 +8391,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 if (!spellInfo) { sLog->outError(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", - GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]); + GetGUIDLow(), GetName().c_str(), pEnchant->ID, pEnchant->spellid[s]); continue; } @@ -11627,7 +11632,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END) { sLog->outError(LOG_FILTER_PLAYER, "Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!", - GetName(), GetGUIDLow(), pItem->GetGUIDLow(), pProto->ItemId); + GetName().c_str(), GetGUIDLow(), pItem->GetGUIDLow(), pProto->ItemId); return EQUIP_ERR_ITEMS_CANT_BE_SWAPPED; } @@ -16967,7 +16972,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { if (GetSession()->Expansion() < mapEntry->Expansion()) { - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player %s using client without required expansion tried login at non accessible map %u", GetName(), mapId); + sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player %s using client without required expansion tried login at non accessible map %u", GetName().c_str(), mapId); RelocateToHomebind(); } @@ -17022,7 +17027,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) Relocate(at->target_X, at->target_Y, at->target_Z, at->target_Orientation); else { - sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), mapId); + sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName().c_str(), GetGUIDLow(), mapId); RelocateToHomebind(); } } @@ -17142,7 +17147,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (m_specsCount > MAX_TALENT_SPECS || m_activeSpec > MAX_TALENT_SPEC || m_specsCount < MIN_TALENT_SPECS) { m_activeSpec = 0; - sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName(), GetGUIDLow(), m_specsCount, m_activeSpec); + sLog->outError(LOG_FILTER_PLAYER, "Player %s(GUID: %u) has SpecCount = %u and ActiveSpec = %u.", GetName().c_str(), GetGUIDLow(), m_specsCount, m_activeSpec); } _LoadTalents(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADTALENTS)); @@ -17565,7 +17570,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) else { sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?", - GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot); + GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot); item->DeleteFromInventoryDB(trans); delete item; continue; @@ -17579,7 +17584,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) else { sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.", - GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot, err); + GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot, err); item->DeleteFromInventoryDB(trans); problematicItems.push_back(item); } @@ -17624,14 +17629,14 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId)) { sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', map: %u) has item (GUID: %u, entry: %u) limited to another map (%u). Deleting item.", - GetGUIDLow(), GetName(), GetMapId(), item->GetGUIDLow(), item->GetEntry(), zoneId); + GetGUIDLow(), GetName().c_str(), GetMapId(), item->GetGUIDLow(), item->GetEntry(), zoneId); remove = true; } // "Conjured items disappear if you are logged out for more than 15 minutes" else if (timeDiff > 15 * MINUTE && proto->Flags & ITEM_PROTO_FLAG_CONJURED) { sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', diff: %u) has conjured item (GUID: %u, entry: %u) with expired lifetime (15 minutes). Deleting item.", - GetGUIDLow(), GetName(), timeDiff, item->GetGUIDLow(), item->GetEntry()); + GetGUIDLow(), GetName().c_str(), timeDiff, item->GetGUIDLow(), item->GetEntry()); remove = true; } else if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE)) @@ -17639,7 +17644,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F if (item->GetPlayedTime() > (2 * HOUR)) { sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.", - GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime()); + GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime()); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); stmt->setUInt32(0, item->GetGUIDLow()); @@ -17662,7 +17667,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F else { sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with refundable flags, but without data in item_refund_instance. Removing flag.", - GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry()); + GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry()); item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE); } } @@ -17684,7 +17689,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F else { sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.", - GetGUIDLow(), GetName(), item->GetGUIDLow(), item->GetEntry()); + GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry()); item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE); } } @@ -17706,7 +17711,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F else { sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.", - GetGUIDLow(), GetName(), itemGuid, itemEntry); + GetGUIDLow(), GetName().c_str(), itemGuid, itemEntry); remove = true; } // Remove item from inventory if necessary @@ -17721,7 +17726,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F else { sLog->outError(LOG_FILTER_PLAYER, "Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.", - GetGUIDLow(), GetName(), itemEntry); + GetGUIDLow(), GetName().c_str(), itemEntry); Item::DeleteFromInventoryDB(trans, itemGuid); Item::DeleteFromDB(trans, itemGuid); } @@ -17888,7 +17893,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) { questStatusData.Status = QUEST_STATUS_INCOMPLETE; sLog->outError(LOG_FILTER_PLAYER, "Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", - GetName(), GetGUIDLow(), quest_id, qstatus); + GetName().c_str(), GetGUIDLow(), quest_id, qstatus); } questStatusData.Explored = (fields[2].GetUInt8() > 0); @@ -18142,12 +18147,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); if (!mapEntry || !mapEntry->IsDungeon()) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName(), GetGUIDLow(), mapId); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName().c_str(), GetGUIDLow(), mapId); deleteInstance = true; } else if (difficulty >= MAX_DIFFICULTY) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName().c_str(), GetGUIDLow(), difficulty, mapId); deleteInstance = true; } else @@ -18155,12 +18160,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty)); if (!mapDiff) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName(), GetGUIDLow(), difficulty, mapId); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName().c_str(), GetGUIDLow(), difficulty, mapId); deleteInstance = true; } else if (!perm && group) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d, %d, %d", GetName(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d, %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty); deleteInstance = true; } } @@ -18285,7 +18290,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, b bind.save = save; bind.perm = permanent; if (!load) - sLog->outDebug(LOG_FILTER_MAPS, "Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); + sLog->outDebug(LOG_FILTER_MAPS, "Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName().c_str(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty()); sScriptMgr->OnPlayerBindToInstance(this, save->GetDifficulty(), save->GetMapId(), permanent); return &bind; } @@ -18506,7 +18511,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { - sLog->outError(LOG_FILTER_PLAYER, "Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName()); + sLog->outError(LOG_FILTER_PLAYER, "Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName().c_str()); return false; } @@ -19029,7 +19034,7 @@ void Player::_SaveInventory(SQLTransaction& trans) uint32 bagTestGUID = 0; if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot())) bagTestGUID = test2->GetGUIDLow(); - sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState()); + sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState()); // according to the test that was just performed nothing should be in this slot, delete stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT); stmt->setUInt32(0, bagTestGUID); @@ -19045,7 +19050,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else if (test != item) { - sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); + sLog->outError(LOG_FILTER_PLAYER, "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); // save all changes to the item... if (item->GetState() != ITEM_NEW) // only for existing items, no dupes item->SaveToDB(trans); @@ -19877,7 +19882,7 @@ void Player::StopCastingCharm() if (GetCharmGUID()) { - sLog->outFatal(LOG_FILTER_PLAYER, "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); + sLog->outFatal(LOG_FILTER_PLAYER, "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); if (charm->GetCharmerGUID()) { sLog->outFatal(LOG_FILTER_PLAYER, "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); @@ -19959,7 +19964,7 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) } else if (!isAddonMessage) // announce to player that player he is whispering to is dnd and cannot receive his message - ChatHandler(this).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName(), rPlayer->dndMsg.c_str()); + ChatHandler(this).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->dndMsg.c_str()); // rest stuff shouldn't happen in case of addon message if (isAddonMessage) @@ -19973,7 +19978,7 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) // announce to player that player he is whispering to is afk if (rPlayer->isAFK()) - ChatHandler(this).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName(), rPlayer->afkMsg.c_str()); + ChatHandler(this).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->afkMsg.c_str()); // if player whisper someone, auto turn of dnd to be able to receive an answer if (isDND() && !rPlayer->isGameMaster()) @@ -21094,7 +21099,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice; if ((uint32)count > maxCount) { - sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to buy %u item id %u, causing overflow", GetName(), (uint32)count, pProto->ItemId); + sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->ItemId); count = (uint8)maxCount; } price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT @@ -21188,7 +21193,7 @@ void Player::UpdateHomebindTime(uint32 time) data << uint32(m_HomebindTimer); data << uint32(1); GetSession()->SendPacket(&data); - sLog->outDebug(LOG_FILTER_MAPS, "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName(), GetGUIDLow()); + sLog->outDebug(LOG_FILTER_MAPS, "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName().c_str(), GetGUIDLow()); } } @@ -23460,11 +23465,11 @@ void Player::SetViewpoint(WorldObject* target, bool apply) { if (apply) { - sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName(), target->GetEntry(), target->GetTypeId()); + sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId()); if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName()); + sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str()); return; } @@ -23476,11 +23481,11 @@ void Player::SetViewpoint(WorldObject* target, bool apply) } else { - sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s remove seer", GetName()); + sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s remove seer", GetName().c_str()); if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName()); + sLog->outFatal(LOG_FILTER_PLAYER, "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str()); return; } @@ -24775,7 +24780,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset) if (!found) // something wrong... { - sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName(), eqset.Guid, index); + sLog->outError(LOG_FILTER_PLAYER, "Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index); return; } } @@ -25237,12 +25242,12 @@ void Player::SetReputation(uint32 factionentry, uint32 value) { GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value); } -uint32 Player::GetReputation(uint32 factionentry) +uint32 Player::GetReputation(uint32 factionentry) const { return GetReputationMgr().GetReputation(sFactionStore.LookupEntry(factionentry)); } -std::string Player::GetGuildName() +std::string const& Player::GetGuildName() { return sGuildMgr->GetGuildById(GetGuildId())->GetName(); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 84f17643d98..722abe4f0e4 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1660,8 +1660,8 @@ class Player : public Unit, public GridObject<Player> void AddTemporarySpell(uint32 spellId); void RemoveTemporarySpell(uint32 spellId); void SetReputation(uint32 factionentry, uint32 value); - uint32 GetReputation(uint32 factionentry); - std::string GetGuildName(); + uint32 GetReputation(uint32 factionentry) const; + std::string const& GetGuildName(); uint32 GetFreeTalentPoints() const { return GetUInt32Value(PLAYER_CHARACTER_POINTS1); } void SetFreeTalentPoints(uint32 points); bool resetTalents(bool no_cost = false); diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 1ded8cda81b..bc16a7f42a2 100755 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -182,9 +182,9 @@ void PlayerSocial::SendSocialList(Player* player) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CONTACT_LIST"); } -bool PlayerSocial::HasFriend(uint32 friend_guid) +bool PlayerSocial::HasFriend(uint32 friendGuid) { - PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid); + PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friendGuid); if (itr != m_playerSocialMap.end()) return itr->second.Flags & SOCIAL_FLAG_FRIEND; return false; @@ -231,7 +231,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (pFriend && pFriend->GetName() && + if (pFriend && (!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) && pFriend->IsVisibleGloballyFor(player)) @@ -249,18 +249,18 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket* data) { - data->Initialize(SMSG_FRIEND_STATUS, 5); + data->Initialize(SMSG_FRIEND_STATUS, 9); *data << uint8(result); *data << uint64(guid); } -void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, uint32 friend_guid, bool broadcast) +void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, uint32 friendGuid, bool broadcast) { FriendInfo fi; WorldPacket data; - MakeFriendStatusPacket(result, friend_guid, &data); - GetFriendInfo(player, friend_guid, fi); + MakeFriendStatusPacket(result, friendGuid, &data); + GetFriendInfo(player, friendGuid, fi); switch (result) { case FRIEND_ADDED_OFFLINE: @@ -329,7 +329,7 @@ PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid) if (!result) return social; - uint32 friend_guid = 0; + uint32 friendGuid = 0; uint8 flags = 0; std::string note = ""; @@ -337,11 +337,11 @@ PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid) { Field* fields = result->Fetch(); - friend_guid = fields[0].GetUInt32(); + friendGuid = fields[0].GetUInt32(); flags = fields[1].GetUInt8(); note = fields[2].GetString(); - social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note); + social->m_playerSocialMap[friendGuid] = FriendInfo(flags, note); // client's friends list and ignore list limit if (social->m_playerSocialMap.size() >= (SOCIALMGR_FRIEND_LIMIT + SOCIALMGR_IGNORE_LIMIT)) @@ -351,4 +351,3 @@ PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, uint32 guid) return social; } - diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h index 99a40d6110f..7ad1cc4c18e 100755 --- a/src/server/game/Entities/Player/SocialMgr.h +++ b/src/server/game/Entities/Player/SocialMgr.h @@ -55,12 +55,10 @@ struct FriendInfo std::string Note; FriendInfo() : Status(FRIEND_STATUS_OFFLINE), Flags(0), Area(0), Level(0), Class(0), Note() - { - } + { } FriendInfo(uint8 flags, const std::string& note) : Status(FRIEND_STATUS_OFFLINE), Flags(flags), Area(0), Level(0), Class(0), Note(note) - { - } + { } }; typedef std::map<uint32, FriendInfo> PlayerSocialMap; @@ -149,4 +147,3 @@ class SocialMgr #define sSocialMgr ACE_Singleton<SocialMgr, ACE_Null_Mutex>::instance() #endif - diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index e7084353491..f52d0059a36 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -507,7 +507,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) bool Transport::AddPassenger(Player* passenger) { if (m_passengers.insert(passenger).second) - sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s boarded transport %s.", passenger->GetName(), GetName()); + sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s boarded transport %s.", passenger->GetName().c_str(), GetName().c_str()); sScriptMgr->OnAddPassenger(this, passenger); return true; @@ -516,7 +516,7 @@ bool Transport::AddPassenger(Player* passenger) bool Transport::RemovePassenger(Player* passenger) { if (m_passengers.erase(passenger)) - sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s removed from transport %s.", passenger->GetName(), GetName()); + sLog->outInfo(LOG_FILTER_TRANSPORTS, "Player %s removed from transport %s.", passenger->GetName().c_str(), GetName().c_str()); sScriptMgr->OnRemovePassenger(this, passenger); return true; @@ -605,7 +605,7 @@ void Transport::DoEventIfAny(WayPointMap::value_type const& node, bool departure { if (uint32 eventid = departure ? node.second.departureEventID : node.second.arrivalEventID) { - sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.first, GetName()); + sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of %s path", departure ? "departure" : "arrival", eventid, node.first, GetName().c_str()); GetMap()->ScriptsStart(sEventScripts, eventid, this, this); EventInform(eventid); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 47449c2bf88..bcaacf76cb1 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9232,11 +9232,11 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const if (GetGUID() != guid) { if (Player const* player = ToPlayer()) - sLog->outError(LOG_FILTER_UNITS, "Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction()); + sLog->outError(LOG_FILTER_UNITS, "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction()); else if (Creature const* creature = ToCreature()) sLog->outError(LOG_FILTER_UNITS, "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); else - sLog->outError(LOG_FILTER_UNITS, "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction()); + sLog->outError(LOG_FILTER_UNITS, "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction()); guid = GetGUID(); } @@ -9982,7 +9982,7 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID()); + sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); charm->m_ControlledByPlayer = true; // TODO: maybe we can use this flag to check if controlled by player @@ -10011,7 +10011,7 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName(), charm->GetEntry(), GetCharmGUID()); + sLog->outFatal(LOG_FILTER_UNITS, "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); } if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) @@ -17494,7 +17494,7 @@ void Unit::StopAttackFaction(uint32 faction_id) void Unit::OutDebugInfo() const { sLog->outError(LOG_FILTER_UNITS, "Unit::OutDebugInfo"); - sLog->outInfo(LOG_FILTER_UNITS, "GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName()); + sLog->outInfo(LOG_FILTER_UNITS, "GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str()); sLog->outInfo(LOG_FILTER_UNITS, "OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); sLog->outInfo(LOG_FILTER_UNITS, "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); if (IsInWorld()) diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index a9cd1bc3824..1159b935277 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -323,7 +323,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) ASSERT(!seat->second.Passenger); } - sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); + sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); seat->second.Passenger = unit->GetGUID(); if (seat->second.SeatInfo->CanEnterOrExit()) @@ -397,7 +397,7 @@ void Vehicle::RemovePassenger(Unit* unit) SeatMap::iterator seat = GetSeatIteratorForPassenger(unit); ASSERT(seat != Seats.end()); - sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); + sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); seat->second.Passenger = 0; if (seat->second.SeatInfo->CanEnterOrExit()) diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 81a132a40d8..b19abc778a9 100755 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -163,7 +163,7 @@ Unit* ObjectAccessor::FindUnit(uint64 guid) return GetObjectInWorld(guid, (Unit*)NULL); } -Player* ObjectAccessor::FindPlayerByName(const char* name) +Player* ObjectAccessor::FindPlayerByName(std::string const& name) { TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock()); std::string nameStr = name; diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 0a1b41eb292..41a7abc9a24 100755 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -74,12 +74,11 @@ class HashMapHolder static LockType* GetLock() { return &i_lock; } private: - //Non instanceable only static HashMapHolder() {} static LockType i_lock; - static MapType m_objectMap; + static MapType m_objectMap; }; class ObjectAccessor @@ -120,9 +119,7 @@ class ObjectAccessor static Player* GetObjectInWorld(uint64 guid, Player* /*typeSpecifier*/) { Player* player = HashMapHolder<Player>::Find(guid); - if (player && player->IsInWorld()) - return player; - return NULL; + return player && player->IsInWorld() ? player : NULL; } static Unit* GetObjectInWorld(uint64 guid, Unit* /*typeSpecifier*/) @@ -193,7 +190,7 @@ class ObjectAccessor static Player* FindPlayer(uint64); static Creature* FindCreature(uint64); static Unit* FindUnit(uint64); - static Player* FindPlayerByName(const char* name); + static Player* FindPlayerByName(std::string const& name); // when using this, you must use the hashmapholder's lock static HashMapHolder<Player>::MapType const& GetPlayers() diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index ac1c04215da..59759b19ef5 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -2093,7 +2093,7 @@ void Group::BroadcastGroupUpdate(void) { pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2); pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE); - sLog->outDebug(LOG_FILTER_GENERAL, "-- Forced group value update for '%s'", pp->GetName()); + sLog->outDebug(LOG_FILTER_GENERAL, "-- Forced group value update for '%s'", pp->GetName().c_str()); } } } @@ -2101,12 +2101,12 @@ void Group::BroadcastGroupUpdate(void) void Group::ResetMaxEnchantingLevel() { m_maxEnchantingLevel = 0; - Player* pMember = NULL; + Player* member = NULL; for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - pMember = ObjectAccessor::FindPlayer(citr->guid); - if (pMember && m_maxEnchantingLevel < pMember->GetSkillValue(SKILL_ENCHANTING)) - m_maxEnchantingLevel = pMember->GetSkillValue(SKILL_ENCHANTING); + member = ObjectAccessor::FindPlayer(citr->guid); + if (member && m_maxEnchantingLevel < member->GetSkillValue(SKILL_ENCHANTING)) + m_maxEnchantingLevel = member->GetSkillValue(SKILL_ENCHANTING); } } diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 332c0924b61..7ab356ac318 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -940,7 +940,7 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && !AccountMgr::IsPlayerAccount(m_pPlayer->GetSession()->GetSecurity())) // TODO: move to scripts sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", - m_pPlayer->GetName(), m_pPlayer->GetSession()->GetAccountId(), + m_pPlayer->GetName().c_str(), m_pPlayer->GetSession()->GetAccountId(), pFrom->GetItem()->GetTemplate()->Name1.c_str(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(), m_pGuild->GetId()); } @@ -1110,7 +1110,7 @@ bool Guild::Create(Player* pLeader, const std::string& name) _CreateLogHolders(); sLog->outDebug(LOG_FILTER_GUILD, "GUILD: creating guild [%s] for leader %s (%u)", - name.c_str(), pLeader->GetName(), GUID_LOPART(m_leaderGuid)); + name.c_str(), pLeader->GetName().c_str(), GUID_LOPART(m_leaderGuid)); PreparedStatement* stmt = NULL; SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -1324,7 +1324,7 @@ void Guild::HandleSetLeader(WorldSession* session, const std::string& name) { _SetLeaderGUID(pNewLeader); pOldLeader->ChangeRank(GR_OFFICER); - _BroadcastEvent(GE_LEADER_CHANGED, 0, player->GetName(), name.c_str()); + _BroadcastEvent(GE_LEADER_CHANGED, 0, player->GetName().c_str(), name.c_str()); } } else @@ -1402,9 +1402,9 @@ void Guild::HandleBuyBankTab(WorldSession* session, uint8 tabId) SendBankTabsInfo(session); } -void Guild::HandleInviteMember(WorldSession* session, const std::string& name) +void Guild::HandleInviteMember(WorldSession* session, std::string const& name) { - Player* pInvitee = sObjectAccessor->FindPlayerByName(name.c_str()); + Player* pInvitee = sObjectAccessor->FindPlayerByName(name); if (!pInvitee) { SendCommandResult(session, GUILD_INVITE_S, ERR_GUILD_PLAYER_NOT_FOUND_S, name); @@ -1439,7 +1439,7 @@ void Guild::HandleInviteMember(WorldSession* session, const std::string& name) return; } - sLog->outDebug(LOG_FILTER_GUILD, "Player %s invited %s to join his Guild", player->GetName(), name.c_str()); + sLog->outDebug(LOG_FILTER_GUILD, "Player %s invited %s to join his Guild", player->GetName().c_str(), name.c_str()); pInvitee->SetGuildIdInvited(m_id); _LogEvent(GUILD_EVENT_LOG_INVITE_PLAYER, player->GetGUIDLow(), pInvitee->GetGUIDLow()); @@ -1462,7 +1462,7 @@ void Guild::HandleAcceptMember(WorldSession* session) if (AddMember(player->GetGUID())) { _LogEvent(GUILD_EVENT_LOG_JOIN_GUILD, player->GetGUIDLow()); - _BroadcastEvent(GE_JOINED, player->GetGUID(), player->GetName()); + _BroadcastEvent(GE_JOINED, player->GetGUID(), player->GetName().c_str()); } } @@ -1484,7 +1484,7 @@ void Guild::HandleLeaveMember(WorldSession* session) DeleteMember(player->GetGUID(), false, false); _LogEvent(GUILD_EVENT_LOG_LEAVE_GUILD, player->GetGUIDLow()); - _BroadcastEvent(GE_LEFT, player->GetGUID(), player->GetName()); + _BroadcastEvent(GE_LEFT, player->GetGUID(), player->GetName().c_str()); SendCommandResult(session, GUILD_QUIT_S, ERR_PLAYER_NO_MORE_IN_GUILD, m_name); } @@ -1511,7 +1511,7 @@ void Guild::HandleRemoveMember(WorldSession* session, const std::string& name) // After call to DeleteMember pointer to member becomes invalid DeleteMember(guid, false, true); _LogEvent(GUILD_EVENT_LOG_UNINVITE_PLAYER, player->GetGUIDLow(), GUID_LOPART(guid)); - _BroadcastEvent(GE_REMOVED, 0, name.c_str(), player->GetName()); + _BroadcastEvent(GE_REMOVED, 0, name.c_str(), player->GetName().c_str()); } } } @@ -1562,7 +1562,7 @@ void Guild::HandleUpdateMemberRank(WorldSession* session, const std::string& nam uint32 newRankId = member->GetRankId() + (demote ? 1 : -1); member->ChangeRank(newRankId); _LogEvent(demote ? GUILD_EVENT_LOG_DEMOTE_PLAYER : GUILD_EVENT_LOG_PROMOTE_PLAYER, player->GetGUIDLow(), GUID_LOPART(member->GetGUID()), newRankId); - _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName(), name.c_str(), _GetRankName(newRankId).c_str()); + _BroadcastEvent(demote ? GE_DEMOTION : GE_PROMOTION, 0, player->GetName().c_str(), name.c_str(), _GetRankName(newRankId).c_str()); } } @@ -1630,7 +1630,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) { sLog->outCommand(player->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)", - player->GetName(), player->GetSession()->GetAccountId(), amount, m_id); + player->GetName().c_str(), player->GetSession()->GetAccountId(), amount, m_id); } // Log guild bank event _LogBankEvent(trans, GUILD_BANK_LOG_DEPOSIT_MONEY, uint8(0), player->GetGUIDLow(), amount); @@ -1696,7 +1696,7 @@ void Guild::HandleMemberLogout(WorldSession* session) member->SetStats(player); member->UpdateLogoutTime(); } - _BroadcastEvent(GE_SIGNED_OFF, player->GetGUID(), player->GetName()); + _BroadcastEvent(GE_SIGNED_OFF, player->GetGUID(), player->GetName().c_str()); } void Guild::HandleDisband(WorldSession* session) @@ -1820,7 +1820,7 @@ void Guild::SendLoginInfo(WorldSession* session) const SendBankTabsInfo(session); - _BroadcastEvent(GE_SIGNED_ON, session->GetPlayer()->GetGUID(), session->GetPlayer()->GetName()); + _BroadcastEvent(GE_SIGNED_ON, session->GetPlayer()->GetGUID(), session->GetPlayer()->GetName().c_str()); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index 8fb820713ce..e62a1f0df07 100755 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.cpp @@ -90,7 +90,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData) if (!normalizePlayerName(invitedName)) return; - player = sObjectAccessor->FindPlayerByName(invitedName.c_str()); + player = sObjectAccessor->FindPlayerByName(invitedName); } if (!player) @@ -140,7 +140,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData) return; } - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName(), invitedName.c_str()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName().c_str(), invitedName.c_str()); player->SetArenaTeamIdInvited(arenaTeam->GetId()); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 74d4f4102cf..aaf0ba3cdf0 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -262,7 +262,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(item); auctionHouse->AddAuction(AH); @@ -308,7 +308,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + sLog->outInfo(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 25c8cd3cc2a..a1adef57ed5 100755 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -190,7 +190,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); SendPacket(&data); sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", - bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName()); + bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str()); } else { @@ -237,10 +237,10 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) member->GetSession()->SendPacket(&data); sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); member->GetSession()->SendPacket(&data); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s", + bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str()); } sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: group end"); - } sBattlegroundMgr->ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); } @@ -331,7 +331,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket &recv_data) BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); if (!bl) { - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId, _player->GetName(), _player->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId, _player->GetName().c_str(), _player->GetGUIDLow()); return; } @@ -354,13 +354,13 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId_, _player->GetName(), _player->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: invalid bgtype (%u) with player (Name: %s, GUID: %u) received.", bgTypeId_, _player->GetName().c_str(), _player->GetGUIDLow()); return; } if (!_player->InBattlegroundQueue()) { - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (Name: %s, GUID: %u), he is not in bg_queue.", _player->GetName(), _player->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (Name: %s, GUID: %u), he is not in bg_queue.", _player->GetName().c_str(), _player->GetGUIDLow()); return; } @@ -409,13 +409,13 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data2, ERR_GROUP_JOIN_BATTLEGROUND_DESERTERS); _player->GetSession()->SendPacket(&data2); action = 0; - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName().c_str(), _player->GetGUIDLow()); } //if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue if (_player->getLevel() > bg->GetMaxLevel()) { sLog->outError(LOG_FILTER_NETWORKIO, "Battleground: Player %s (%u) has level (%u) higher than maxlevel (%u) of battleground (%u)! Do not port him to battleground!", - _player->GetName(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID()); + _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel(), bg->GetMaxLevel(), bg->GetTypeID()); action = 0; } } @@ -460,7 +460,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) sBattlegroundMgr->SendToBattleground(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId); // add only in HandleMoveWorldPortAck() // bg->AddPlayer(_player, team); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); break; case 0: // leave queue if (bg->isArena() && bg->GetStatus() > STATUS_WAIT_QUEUE) @@ -484,7 +484,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) if (!ginfo.ArenaType) sBattlegroundMgr->ScheduleQueueUpdate(ginfo.ArenaMatchmakerRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); SendPacket(&data); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName().c_str(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); break; default: sLog->outError(LOG_FILTER_NETWORKIO, "Battleground port: unknown action %u", action); @@ -691,7 +691,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: arena join as group start"); if (isRated) { - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: arena team id %u, leader %s queued with matchmaker rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName(), matchmakerRating, arenatype); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: arena team id %u, leader %s queued with matchmaker rating %u for type %u", _player->GetArenaTeamId(arenaslot), _player->GetName().c_str(), matchmakerRating, arenatype); bg->SetRated(true); } else @@ -724,7 +724,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) member->GetSession()->SendPacket(&data); sBattlegroundMgr->BuildGroupJoinedBattlegroundPacket(&data, err); member->GetSession()->SendPacket(&data); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, member->GetGUIDLow(), member->GetName().c_str()); } } else @@ -737,7 +737,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) // send status packet (in queue) sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); SendPacket(&data); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s", bgQueueTypeId, bgTypeId, _player->GetGUIDLow(), _player->GetName().c_str()); } sBattlegroundMgr->ScheduleQueueUpdate(matchmakerRating, arenatype, bgQueueTypeId, bgTypeId, bracketEntry->GetBracketId()); } @@ -754,7 +754,7 @@ void WorldSession::HandleReportPvPAFK(WorldPacket & recv_data) return; } - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName(), reportedPlayer->GetName()); + sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName().c_str(), reportedPlayer->GetName().c_str()); reportedPlayer->ReportedAfkBy(_player); } diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index d1209eead22..0cecd3d615a 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -404,7 +404,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) uint32 team = 0; recvData >> eventId >> inviteId >> name >> status >> rank; - if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str())) + if (Player* player = sObjectAccessor->FindPlayerByName(name)) { invitee = player->GetGUID(); team = player->GetTeam(); diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 9b749fa8005..a65e3830a81 100755 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -49,9 +49,9 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) if (channelname.empty()) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) { - cMgr->team = _player->GetTeam(); + cMgr->setTeam(_player->GetTeam()); if (Channel* chn = cMgr->GetJoinChannel(channelname, channel_id)) chn->Join(_player->GetGUID(), pass.c_str()); } @@ -69,7 +69,7 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) if (channelname.empty()) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) { if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Leave(_player->GetGUID(), true); @@ -83,7 +83,7 @@ void WorldSession::HandleChannelList(WorldPacket& recvPacket) std::string channelname; recvPacket >> channelname; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->List(_player); } @@ -96,7 +96,7 @@ void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) recvPacket >> pass; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Password(_player->GetGUID(), pass.c_str()); } @@ -112,7 +112,7 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) if (!normalizePlayerName(newp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SetOwner(_player->GetGUID(), newp.c_str()); } @@ -122,7 +122,7 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelname; recvPacket >> channelname; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SendWhoOwner(_player->GetGUID()); } @@ -138,7 +138,7 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SetModerator(_player->GetGUID(), otp.c_str()); } @@ -154,7 +154,7 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->UnsetModerator(_player->GetGUID(), otp.c_str()); } @@ -170,7 +170,7 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SetMute(_player->GetGUID(), otp.c_str()); } @@ -187,7 +187,7 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->UnsetMute(_player->GetGUID(), otp.c_str()); } @@ -203,7 +203,7 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Invite(_player->GetGUID(), otp.c_str()); } @@ -218,7 +218,7 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Kick(_player->GetGUID(), otp.c_str()); } @@ -234,7 +234,7 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Ban(_player->GetGUID(), otp.c_str()); } @@ -251,7 +251,7 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) if (!normalizePlayerName(otp)) return; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->UnBan(_player->GetGUID(), otp.c_str()); } @@ -261,7 +261,7 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelname; recvPacket >> channelname; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Announce(_player->GetGUID()); } @@ -277,7 +277,7 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); std::string channelname; recvPacket >> channelname; - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) { if (Channel* chn = cMgr->GetChannel(channelname, _player)) { @@ -299,4 +299,3 @@ void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->JoinNotify(_player->GetGUID());*/ } - diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 396537c1304..5b8ed4d1fec 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -660,7 +660,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte std::string IP_str = GetRemoteAddress(); sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); - sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel()); + sWorld->AddCharacterNameData(newChar.GetGUIDLow(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel()); newChar.CleanupsBeforeDelete(); delete createInfo; @@ -863,7 +863,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) else { // remove wrong guild data - sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->GetGuildId()); pCurrChar->SetInGuild(0); } } @@ -914,7 +914,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) } sObjectAccessor->AddObject(pCurrChar); - //sLog->outDebug("Player %s added to Map.", pCurrChar->GetName()); + //sLog->outDebug("Player %s added to Map.", pCurrChar->GetName().c_str()); pCurrChar->SendInitialPacketsAfterAddToMap(); @@ -1002,7 +1002,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) std::string IP_str = GetRemoteAddress(); sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", - GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); + GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); @@ -1081,14 +1081,14 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data) void WorldSession::HandleShowingHelmOpcode(WorldPacket& recv_data) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName().c_str()); recv_data.read_skip<uint8>(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); } void WorldSession::HandleShowingCloakOpcode(WorldPacket& recv_data) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str()); recv_data.read_skip<uint8>(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); } diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 711d7af4dc3..105c90a1779 100755 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -24,7 +24,6 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "DatabaseEnv.h" - #include "CellImpl.h" #include "Chat.h" #include "ChannelMgr.h" @@ -52,8 +51,8 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && AccountMgr::IsPlayerAccount(GetSecurity()) && !ChatHandler(this).isValidChatMessage(msg.c_str())) { - sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(), - GetPlayer()->GetGUIDLow(), msg.c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(), + GetPlayer()->GetGUIDLow(), msg.c_str()); if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK)) KickPlayer(); return false; @@ -63,18 +62,18 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg return true; } -void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) +void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) { uint32 type; uint32 lang; - recv_data >> type; - recv_data >> lang; + recvData >> type; + recvData >> lang; if (type >= MAX_CHAT_MSG_TYPE) { sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: Wrong message type received: %u", type); - recv_data.rfinish(); + recvData.rfinish(); return; } @@ -87,7 +86,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (!langDesc) { SendNotification(LANG_UNKNOWN_LANGUAGE); - recv_data.rfinish(); + recvData.rfinish(); return; } if (langDesc->skill_id != 0 && !sender->HasSkill(langDesc->skill_id)) @@ -106,7 +105,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (!foundAura) { SendNotification(LANG_NOT_LEARNED_LANGUAGE); - recv_data.rfinish(); + recvData.rfinish(); return; } } @@ -116,7 +115,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) { std::string msg = ""; - recv_data >> msg; + recvData >> msg; if (msg.empty()) return; @@ -171,7 +170,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { std::string timeStr = secsToTimeString(m_muteTime - time(NULL)); SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str()); - recv_data.rfinish(); // Prevent warnings + recvData.rfinish(); // Prevent warnings return; } @@ -182,9 +181,9 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (sender->HasAura(1852) && type != CHAT_MSG_WHISPER) { std::string msg=""; - recv_data >> msg; + recvData >> msg; - SendNotification(GetTrinityString(LANG_GM_SILENCE), sender->GetName()); + SendNotification(GetTrinityString(LANG_GM_SILENCE), sender->GetName().c_str()); return; } @@ -204,19 +203,19 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) case CHAT_MSG_RAID_WARNING: case CHAT_MSG_BATTLEGROUND: case CHAT_MSG_BATTLEGROUND_LEADER: - recv_data >> msg; + recvData >> msg; break; case CHAT_MSG_WHISPER: - recv_data >> to; - recv_data >> msg; + recvData >> to; + recvData >> msg; break; case CHAT_MSG_CHANNEL: - recv_data >> channel; - recv_data >> msg; + recvData >> channel; + recvData >> msg; break; case CHAT_MSG_AFK: case CHAT_MSG_DND: - recv_data >> msg; + recvData >> msg; ignoreChecks = true; break; } @@ -269,7 +268,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) break; } - Player* receiver = sObjectAccessor->FindPlayerByName(to.c_str()); + Player* receiver = sObjectAccessor->FindPlayerByName(to); bool senderIsPlayer = AccountMgr::IsPlayerAccount(GetSecurity()); bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER); if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) @@ -287,7 +286,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) if (GetPlayer()->HasAura(1852) && !receiver->isGameMaster()) { - SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName()); + SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName().c_str()); return; } @@ -426,13 +425,11 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } } - if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(_player->GetTeam())) { - if (Channel* chn = cMgr->GetChannel(channel, _player)) { sScriptMgr->OnPlayerChat(_player, type, lang, msg, chn); - chn->Say(_player->GetGUID(), msg.c_str(), lang); } } @@ -479,13 +476,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } } -void WorldSession::HandleEmoteOpcode(WorldPacket & recv_data) +void WorldSession::HandleEmoteOpcode(WorldPacket& recvData) { if (!GetPlayer()->isAlive() || GetPlayer()->HasUnitState(UNIT_STATE_DIED)) return; uint32 emote; - recv_data >> emote; + recvData >> emote; sScriptMgr->OnPlayerEmote(GetPlayer(), emote); GetPlayer()->HandleEmoteCommand(emote); } @@ -500,18 +497,18 @@ namespace Trinity void operator()(WorldPacket& data, LocaleConstant loc_idx) { - char const* nam = i_target ? i_target->GetNameForLocaleIdx(loc_idx) : NULL; - uint32 namlen = (nam ? strlen(nam) : 0) + 1; + std::string const name(i_target ? i_target->GetNameForLocaleIdx(loc_idx) : ""); + uint32 namlen = name.size(); - data.Initialize(SMSG_TEXT_EMOTE, (20+namlen)); + data.Initialize(SMSG_TEXT_EMOTE, 20 + namlen); data << i_player.GetGUID(); - data << (uint32)i_text_emote; - data << i_emote_num; - data << (uint32)namlen; + data << uint32(i_text_emote); + data << uint32(i_emote_num); + data << uint32(namlen); if (namlen > 1) - data.append(nam, namlen); + data << name; else - data << (uint8)0x00; + data << uint8(0x00); } private: @@ -522,7 +519,7 @@ namespace Trinity }; } // namespace Trinity -void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) +void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData) { if (!GetPlayer()->isAlive()) return; @@ -537,9 +534,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) uint32 text_emote, emoteNum; uint64 guid; - recv_data >> text_emote; - recv_data >> emoteNum; - recv_data >> guid; + recvData >> text_emote; + recvData >> emoteNum; + recvData >> guid; sScriptMgr->OnPlayerTextEmote(GetPlayer(), text_emote, emoteNum, guid); @@ -584,21 +581,21 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) ((Creature*)unit)->AI()->ReceiveEmote(GetPlayer(), text_emote); } -void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recv_data) +void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData) { uint64 iguid; uint8 unk; //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_CHAT_IGNORED"); - recv_data >> iguid; - recv_data >> unk; // probably related to spam reporting + recvData >> iguid; + recvData >> unk; // probably related to spam reporting Player* player = ObjectAccessor::FindPlayer(iguid); if (!player || !player->GetSession()) return; WorldPacket data; - ChatHandler::FillMessageData(&data, this, CHAT_MSG_IGNORED, LANG_UNIVERSAL, NULL, GetPlayer()->GetGUID(), GetPlayer()->GetName(), NULL); + ChatHandler::FillMessageData(&data, this, CHAT_MSG_IGNORED, LANG_UNIVERSAL, NULL, GetPlayer()->GetGUID(), GetPlayer()->GetName().c_str(), NULL); player->GetSession()->SendPacket(&data); } diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index 1b3f71c8cf1..bdfb2369198 100755 --- a/src/server/game/Handlers/DuelHandler.cpp +++ b/src/server/game/Handlers/DuelHandler.cpp @@ -42,8 +42,8 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) return; //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED"); - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName()); - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str()); time_t now = time(NULL); player->duel->startTimer = now; diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 43655750aff..147e698d20e 100755 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -73,7 +73,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data) return; } - Player* player = sObjectAccessor->FindPlayerByName(membername.c_str()); + Player* player = sObjectAccessor->FindPlayerByName(membername); // no player if (!player) @@ -210,7 +210,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recv_data) if (group->GetLeaderGUID() == GetPlayer()->GetGUID()) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -265,9 +265,8 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/) return; // report - std::string name = std::string(GetPlayer()->GetName()); - WorldPacket data(SMSG_GROUP_DECLINE, name.length()); - data << name.c_str(); + WorldPacket data(SMSG_GROUP_DECLINE, GetPlayer()->GetName().length()); + data << GetPlayer()->GetName(); leader->GetSession()->SendPacket(&data); } @@ -283,7 +282,8 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) //can't uninvite yourself if (guid == GetPlayer()->GetGUID()) { - sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", + GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -333,7 +333,8 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) // can't uninvite yourself if (GetPlayer()->GetName() == membername) { - sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", + GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -586,7 +587,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket & recv_data) if (!group->HasFreeSlotSubGroup(groupNr)) return; - Player* movedPlayer = sObjectAccessor->FindPlayerByName(name.c_str()); + Player* movedPlayer = sObjectAccessor->FindPlayerByName(name); uint64 guid; if (movedPlayer) { diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 73c8457eb66..ebeac2d486b 100755 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -445,7 +445,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (!target) return; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); if (_player->GetLootGUID() != lootguid) return; @@ -474,7 +474,8 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (slotid >= loot->items.size() + loot->quest_items.size()) { - sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)loot->items.size()); + sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", + GetPlayer()->GetName().c_str(), slotid, (unsigned long)loot->items.size()); return; } diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index e6e32e81e51..c91cdf22ba8 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -56,11 +56,11 @@ #include "Battlefield.h" #include "BattlefieldMgr.h" -void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) +void WorldSession::HandleRepopRequestOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REPOP_REQUEST Message"); - recv_data.read_skip<uint8>(); + recvData.read_skip<uint8>(); if (GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; @@ -75,7 +75,8 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) // release spirit after he's killed but before he is updated if (GetPlayer()->getDeathState() == JUST_DIED) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", + GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); GetPlayer()->KillPlayer(); } @@ -85,7 +86,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) GetPlayer()->RepopAtGraveyard(); } -void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) +void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION"); @@ -94,10 +95,10 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) uint64 guid; std::string code = ""; - recv_data >> guid >> menuId >> gossipListId; + recvData >> guid >> menuId >> gossipListId; if (_player->PlayerTalkClass->IsGossipOptionCoded(gossipListId)) - recv_data >> code; + recvData >> code; Creature* unit = NULL; GameObject* go = NULL; @@ -170,7 +171,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) } } -void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) +void WorldSession::HandleWhoOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); @@ -185,15 +186,15 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) uint32 zoneids[10]; // 10 is client limit std::string player_name, guild_name; - recv_data >> level_min; // maximal player level, default 0 - recv_data >> level_max; // minimal player level, default 100 (MAX_LEVEL) - recv_data >> player_name; // player name, case sensitive... + recvData >> level_min; // maximal player level, default 0 + recvData >> level_max; // minimal player level, default 100 (MAX_LEVEL) + recvData >> player_name; // player name, case sensitive... - recv_data >> guild_name; // guild name, case sensitive... + recvData >> guild_name; // guild name, case sensitive... - recv_data >> racemask; // race mask - recv_data >> classmask; // class mask - recv_data >> zones_count; // zones count, client limit = 10 (2.0.10) + recvData >> racemask; // race mask + recvData >> classmask; // class mask + recvData >> zones_count; // zones count, client limit = 10 (2.0.10) if (zones_count > 10) return; // can't be received from real client or broken packet @@ -201,12 +202,12 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) for (uint32 i = 0; i < zones_count; ++i) { uint32 temp; - recv_data >> temp; // zone id, 0 if zone is unknown... + recvData >> temp; // zone id, 0 if zone is unknown... zoneids[i] = temp; sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]); } - recv_data >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10) + recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10) if (str_count > 4) return; // can't be received from real client or broken packet @@ -217,7 +218,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) for (uint32 i = 0; i < str_count; ++i) { std::string temp; - recv_data >> temp; // user entered string, it used as universal search pattern(guild+player name)? + recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)? if (!Utf8toWStr(temp, str[i])) continue; @@ -367,7 +368,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message"); } -void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity()); @@ -424,12 +425,12 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) LogoutRequest(time(NULL)); } -void WorldSession::HandlePlayerLogoutOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandlePlayerLogoutOpcode(WorldPacket& /*recvData*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_PLAYER_LOGOUT Message"); } -void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recvData*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_CANCEL Message"); @@ -461,13 +462,13 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket & /*recv_data*/) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LOGOUT_CANCEL_ACK Message"); } -void WorldSession::HandleTogglePvP(WorldPacket & recv_data) +void WorldSession::HandleTogglePvP(WorldPacket& recvData) { // this opcode can be used in two ways: Either set explicit new status or toggle old status - if (recv_data.size() == 1) + if (recvData.size() == 1) { bool newPvPStatus; - recv_data >> newPvPStatus; + recvData >> newPvPStatus; GetPlayer()->ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP, newPvPStatus); GetPlayer()->ApplyModFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER, !newPvPStatus); } @@ -492,10 +493,10 @@ void WorldSession::HandleTogglePvP(WorldPacket & recv_data) // pvp->HandlePlayerActivityChanged(_player); } -void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data) +void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recvData) { uint32 newZone; - recv_data >> newZone; + recvData >> newZone; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd ZONE_UPDATE: %u", newZone); @@ -506,46 +507,47 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket & recv_data) //GetPlayer()->SendInitWorldStates(true, newZone); } -void WorldSession::HandleSetSelectionOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData) { uint64 guid; - recv_data >> guid; + recvData >> guid; _player->SetSelection(guid); } -void WorldSession::HandleStandStateChangeOpcode(WorldPacket & recv_data) +void WorldSession::HandleStandStateChangeOpcode(WorldPacket& recvData) { - // sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_STANDSTATECHANGE"); -- too many spam in log at lags/debug stop + // sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_STANDSTATECHANGE"); -- too many spam in log at lags/debug stop uint32 animstate; - recv_data >> animstate; + recvData >> animstate; _player->SetStandState(animstate); } -void WorldSession::HandleContactListOpcode(WorldPacket & recv_data) +void WorldSession::HandleContactListOpcode(WorldPacket& recvData) { uint32 unk; - recv_data >> unk; + recvData >> unk; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_CONTACT_LIST - Unk: %d", unk); _player->GetSocial()->SendSocialList(_player); } -void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data) +void WorldSession::HandleAddFriendOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_FRIEND"); std::string friendName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); std::string friendNote; - recv_data >> friendName; + recvData >> friendName; - recv_data >> friendNote; + recvData >> friendNote; if (!normalizePlayerName(friendName)) return; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName(), friendName.c_str()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'", + GetPlayer()->GetName().c_str(), friendName.c_str()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME); @@ -596,7 +598,7 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std if (!GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false)) { friendResult = FRIEND_LIST_FULL; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s's friend list is full.", GetPlayer()->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str()); } } GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote); @@ -609,13 +611,13 @@ void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleDelFriendOpcode(WorldPacket & recv_data) +void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData) { uint64 FriendGUID; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DEL_FRIEND"); - recv_data >> FriendGUID; + recvData >> FriendGUID; _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), false); @@ -624,19 +626,19 @@ void WorldSession::HandleDelFriendOpcode(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleAddIgnoreOpcode(WorldPacket & recv_data) +void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_IGNORE"); std::string ignoreName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); - recv_data >> ignoreName; + recvData >> ignoreName; if (!normalizePlayerName(ignoreName)) return; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to Ignore: '%s'", - GetPlayer()->GetName(), ignoreName.c_str()); + GetPlayer()->GetName().c_str(), ignoreName.c_str()); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME); @@ -682,13 +684,13 @@ void WorldSession::HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data) +void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData) { uint64 IgnoreGUID; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DEL_IGNORE"); - recv_data >> IgnoreGUID; + recvData >> IgnoreGUID; _player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), true); @@ -697,23 +699,23 @@ void WorldSession::HandleDelIgnoreOpcode(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } -void WorldSession::HandleSetContactNotesOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_CONTACT_NOTES"); uint64 guid; std::string note; - recv_data >> guid >> note; + recvData >> guid >> note; _player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note); } -void WorldSession::HandleBugOpcode(WorldPacket & recv_data) +void WorldSession::HandleBugOpcode(WorldPacket& recvData) { uint32 suggestion, contentlen, typelen; std::string content, type; - recv_data >> suggestion >> contentlen >> content; + recvData >> suggestion >> contentlen >> content; - recv_data >> typelen >> type; + recvData >> typelen >> type; if (suggestion == 0) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUG [Bug Report]"); @@ -731,12 +733,12 @@ void WorldSession::HandleBugOpcode(WorldPacket & recv_data) CharacterDatabase.Execute(stmt); } -void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) +void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE"); uint64 guid; - recv_data >> guid; + recvData >> guid; if (GetPlayer()->isAlive()) return; @@ -768,14 +770,14 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) GetPlayer()->SpawnCorpseBones(); } -void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) +void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE"); uint64 guid; uint8 status; - recv_data >> guid; - recv_data >> status; + recvData >> guid; + recvData >> status; if (GetPlayer()->isAlive()) return; @@ -809,10 +811,10 @@ void WorldSession::SendAreaTriggerMessage(const char* Text, ...) SendPacket(&data); } -void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) +void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) { uint32 triggerId; - recv_data >> triggerId; + recvData >> triggerId; sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_AREATRIGGER. Trigger ID: %u", triggerId); @@ -820,7 +822,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) if (player->isInFlight()) { sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", - player->GetName(), player->GetGUIDLow(), triggerId); + player->GetName().c_str(), player->GetGUIDLow(), triggerId); return; } @@ -828,14 +830,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) if (!atEntry) { sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", - player->GetName(), player->GetGUIDLow(), triggerId); + player->GetName().c_str(), player->GetGUIDLow(), triggerId); return; } if (player->GetMapId() != atEntry->mapid) { sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", - player->GetName(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId); + player->GetName().c_str(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId); return; } @@ -849,7 +851,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) if (dist > atEntry->radius + delta) { sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u", - player->GetName(), player->GetGUIDLow(), atEntry->radius, dist, triggerId); + player->GetName().c_str(), player->GetGUIDLow(), atEntry->radius, dist, triggerId); return; } } @@ -880,7 +882,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) (fabs(dz) > atEntry->box_z / 2 + delta)) { sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u", - player->GetName(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId); + player->GetName().c_str(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId); return; } } @@ -939,12 +941,12 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT); } -void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) +void WorldSession::HandleUpdateAccountData(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); uint32 type, timestamp, decompressedSize; - recv_data >> type >> timestamp >> decompressedSize; + recvData >> type >> timestamp >> decompressedSize; sLog->outDebug(LOG_FILTER_NETWORKIO, "UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize); @@ -965,7 +967,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) if (decompressedSize > 0xFFFF) { - recv_data.rfinish(); // unnneded warning spam in this case + recvData.rfinish(); // unnneded warning spam in this case sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Account data packet too big, size %u", decompressedSize); return; } @@ -974,14 +976,14 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) dest.resize(decompressedSize); uLongf realSize = decompressedSize; - if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recv_data.contents() + recv_data.rpos()), recv_data.size() - recv_data.rpos()) != Z_OK) + if (uncompress(const_cast<uint8*>(dest.contents()), &realSize, const_cast<uint8*>(recvData.contents() + recvData.rpos()), recvData.size() - recvData.rpos()) != Z_OK) { - recv_data.rfinish(); // unnneded warning spam in this case + recvData.rfinish(); // unnneded warning spam in this case sLog->outError(LOG_FILTER_NETWORKIO, "UAD: Failed to decompress account data"); return; } - recv_data.rfinish(); // uncompress read (recv_data.size() - recv_data.rpos()) + recvData.rfinish(); // uncompress read (recvData.size() - recvData.rpos()) std::string adata; dest >> adata; @@ -994,12 +996,12 @@ void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) SendPacket(&data); } -void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) +void WorldSession::HandleRequestAccountData(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); uint32 type; - recv_data >> type; + recvData >> type; sLog->outDebug(LOG_FILTER_NETWORKIO, "RAD: type %u", type); @@ -1032,70 +1034,42 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) +void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_ACTION_BUTTON"); uint8 button; uint32 packetData; - recv_data >> button >> packetData; + recvData >> button >> packetData; + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_ACTION_BUTTON Button: %u Data: %u", button, packetData); - uint32 action = ACTION_BUTTON_ACTION(packetData); - uint8 type = ACTION_BUTTON_TYPE(packetData); - - sLog->outInfo(LOG_FILTER_NETWORKIO, "BUTTON: %u ACTION: %u TYPE: %u", button, action, type); if (!packetData) - { - sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Remove action from button %u", button); GetPlayer()->removeActionButton(button); - } else - { - switch (type) - { - case ACTION_BUTTON_MACRO: - case ACTION_BUTTON_CMACRO: - sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Macro %u into button %u", action, button); - break; - case ACTION_BUTTON_EQSET: - sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added EquipmentSet %u into button %u", action, button); - break; - case ACTION_BUTTON_SPELL: - sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Spell %u into button %u", action, button); - break; - case ACTION_BUTTON_ITEM: - sLog->outInfo(LOG_FILTER_NETWORKIO, "MISC: Added Item %u into button %u", action, button); - break; - default: - sLog->outError(LOG_FILTER_NETWORKIO, "MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName(), _player->GetGUIDLow()); - return; - } - GetPlayer()->addActionButton(button, action, type); - } + GetPlayer()->addActionButton(button, ACTION_BUTTON_ACTION(packetData), ACTION_BUTTON_TYPE(packetData)); } -void WorldSession::HandleCompleteCinematic(WorldPacket & /*recv_data*/) +void WorldSession::HandleCompleteCinematic(WorldPacket& /*recvData*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC"); } -void WorldSession::HandleNextCinematicCamera(WorldPacket & /*recv_data*/) +void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recvData*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA"); } -void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data) +void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) { /* WorldSession::Update(getMSTime());*/ sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_TIME_SKIPPED"); uint64 guid; - recv_data.readPackGUID(guid); - recv_data.read_skip<uint32>(); + recvData.readPackGUID(guid); + recvData.read_skip<uint32>(); /* uint64 guid; uint32 time_skipped; - recv_data >> guid; - recv_data >> time_skipped; + recvData >> guid; + recvData >> time_skipped; sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_MOVE_TIME_SKIPPED"); /// TODO @@ -1106,84 +1080,84 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket & recv_data) */ } -void WorldSession::HandleFeatherFallAck(WorldPacket &recv_data) +void WorldSession::HandleFeatherFallAck(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); // no used - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam } -void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data) +void WorldSession::HandleMoveUnRootAck(WorldPacket& recvData) { // no used - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam /* uint64 guid; - recv_data >> guid; + recvData >> guid; // now can skip not our packet if (_player->GetGUID() != guid) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK"); - recv_data.read_skip<uint32>(); // unk + recvData.read_skip<uint32>(); // unk MovementInfo movementInfo; movementInfo.guid = guid; - ReadMovementInfo(recv_data, &movementInfo); - recv_data.read_skip<float>(); // unk2 + ReadMovementInfo(recvData, &movementInfo); + recvData.read_skip<float>(); // unk2 */ } -void WorldSession::HandleMoveRootAck(WorldPacket& recv_data) +void WorldSession::HandleMoveRootAck(WorldPacket& recvData) { // no used - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam /* uint64 guid; - recv_data >> guid; + recvData >> guid; // now can skip not our packet if (_player->GetGUID() != guid) { - recv_data.rfinish(); // prevent warnings spam + recvData.rfinish(); // prevent warnings spam return; } sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_ROOT_ACK"); - recv_data.read_skip<uint32>(); // unk + recvData.read_skip<uint32>(); // unk MovementInfo movementInfo; - ReadMovementInfo(recv_data, &movementInfo); + ReadMovementInfo(recvData, &movementInfo); */ } -void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) +void WorldSession::HandleSetActionBarToggles(WorldPacket& recvData) { - uint8 ActionBar; + uint8 actionBar; - recv_data >> ActionBar; + recvData >> actionBar; if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED) { - if (ActionBar != 0) - sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar)); + if (actionBar != 0) + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(actionBar)); return; } - GetPlayer()->SetByteValue(PLAYER_FIELD_BYTES, 2, ActionBar); + GetPlayer()->SetByteValue(PLAYER_FIELD_BYTES, 2, actionBar); } -void WorldSession::HandlePlayedTime(WorldPacket& recv_data) +void WorldSession::HandlePlayedTime(WorldPacket& recvData) { uint8 unk1; - recv_data >> unk1; // 0 or 1 expected + recvData >> unk1; // 0 or 1 expected WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1); data << uint32(_player->GetTotalPlayedTime()); @@ -1192,10 +1166,10 @@ void WorldSession::HandlePlayedTime(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) +void WorldSession::HandleInspectOpcode(WorldPacket& recvData) { uint64 guid; - recv_data >> guid; + recvData >> guid; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_INSPECT"); @@ -1214,9 +1188,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) data.append(player->GetPackGUID()); if (sWorld->getBoolConfig(CONFIG_TALENTS_INSPECTING) || _player->isGameMaster()) - { player->BuildPlayerTalentsInfoData(&data); - } else { data << uint32(0); // unspentTalentPoints @@ -1228,10 +1200,10 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) +void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recvData) { uint64 guid; - recv_data >> guid; + recvData >> guid; Player* player = ObjectAccessor::FindPlayer(guid); @@ -1251,7 +1223,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) SendPacket(&data); } -void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) +void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recvData) { uint32 time; uint32 mapid; @@ -1260,22 +1232,24 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) float PositionZ; float Orientation; - recv_data >> time; // time in m.sec. - recv_data >> mapid; - recv_data >> PositionX; - recv_data >> PositionY; - recv_data >> PositionZ; - recv_data >> Orientation; // o (3.141593 = 180 degrees) + recvData >> time; // time in m.sec. + recvData >> mapid; + recvData >> PositionX; + recvData >> PositionY; + recvData >> PositionZ; + recvData >> Orientation; // o (3.141593 = 180 degrees) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_WORLD_TELEPORT"); if (GetPlayer()->isInFlight()) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.", + GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", GetPlayer()->GetName(), time, mapid, PositionX, PositionY, PositionZ, Orientation); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", + GetPlayer()->GetName().c_str(), time, mapid, PositionX, PositionY, PositionZ, Orientation); if (AccountMgr::IsAdminAccount(GetSecurity())) GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation); @@ -1283,11 +1257,11 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); } -void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) +void WorldSession::HandleWhoisOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WHOIS"); std::string charname; - recv_data >> charname; + recvData >> charname; if (!AccountMgr::IsAdminAccount(GetSecurity())) { @@ -1301,7 +1275,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) return; } - Player* player = sObjectAccessor->FindPlayerByName(charname.c_str()); + Player* player = sObjectAccessor->FindPlayerByName(charname); if (!player) { @@ -1340,10 +1314,11 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) data << msg; SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s", + GetPlayer()->GetName().c_str(), charname.c_str()); } -void WorldSession::HandleComplainOpcode(WorldPacket & recv_data) +void WorldSession::HandleComplainOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_COMPLAIN"); @@ -1354,21 +1329,21 @@ void WorldSession::HandleComplainOpcode(WorldPacket & recv_data) uint32 unk3 = 0; uint32 unk4 = 0; std::string description = ""; - recv_data >> spam_type; // unk 0x01 const, may be spam type (mail/chat) - recv_data >> spammer_guid; // player guid + recvData >> spam_type; // unk 0x01 const, may be spam type (mail/chat) + recvData >> spammer_guid; // player guid switch (spam_type) { case 0: - recv_data >> unk1; // const 0 - recv_data >> unk2; // probably mail id - recv_data >> unk3; // const 0 + recvData >> unk1; // const 0 + recvData >> unk2; // probably mail id + recvData >> unk3; // const 0 break; case 1: - recv_data >> unk1; // probably language - recv_data >> unk2; // message type? - recv_data >> unk3; // probably channel id - recv_data >> unk4; // unk random value - recv_data >> description; // spam description string (messagetype, channel name, player name, message) + recvData >> unk1; // probably language + recvData >> unk2; // message type? + recvData >> unk3; // probably channel id + recvData >> unk4; // unk random value + recvData >> description; // spam description string (messagetype, channel name, player name, message) break; } @@ -1383,13 +1358,13 @@ void WorldSession::HandleComplainOpcode(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "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::HandleRealmSplitOpcode(WorldPacket & recv_data) +void WorldSession::HandleRealmSplitOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_REALM_SPLIT"); uint32 unk; std::string split_date = "01/01/01"; - recv_data >> unk; + recvData >> unk; WorldPacket data(SMSG_REALM_SPLIT, 4+4+split_date.size()+1); data << unk; @@ -1403,12 +1378,12 @@ void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data) //sLog->outDebug("response sent %u", unk); } -void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) +void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_FAR_SIGHT"); uint8 apply; - recv_data >> apply; + recvData >> apply; switch (apply) { @@ -1421,7 +1396,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) if (WorldObject* target = _player->GetViewpoint()) _player->SetSeer(target); else - sLog->outError(LOG_FILTER_NETWORKIO, "Player %s requests non-existing seer " UI64FMTD, _player->GetName(), _player->GetUInt64Value(PLAYER_FARSIGHT)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %s requests non-existing seer " UI64FMTD, _player->GetName().c_str(), _player->GetUInt64Value(PLAYER_FARSIGHT)); break; default: sLog->outDebug(LOG_FILTER_NETWORKIO, "Unhandled mode in CMSG_FAR_SIGHT: %u", apply); @@ -1431,12 +1406,12 @@ void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) GetPlayer()->UpdateVisibilityForPlayer(); } -void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetTitleOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_TITLE"); int32 title; - recv_data >> title; + recvData >> title; // -1 at none if (title > 0 && title < MAX_TITLE_INDEX) @@ -1450,15 +1425,15 @@ void WorldSession::HandleSetTitleOpcode(WorldPacket & recv_data) GetPlayer()->SetUInt32Value(PLAYER_CHOSEN_TITLE, title); } -void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data) +void WorldSession::HandleTimeSyncResp(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_TIME_SYNC_RESP"); uint32 counter, clientTicks; - recv_data >> counter >> clientTicks; + recvData >> counter >> clientTicks; if (counter != _player->m_timeSyncCounter - 1) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Wrong time sync counter from player %s (cheater?)", _player->GetName()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Wrong time sync counter from player %s (cheater?)", _player->GetName().c_str()); sLog->outDebug(LOG_FILTER_NETWORKIO, "Time sync received: counter %u, client ticks %u, time since last sync %u", counter, clientTicks, clientTicks - _player->m_timeSyncClient); @@ -1470,7 +1445,7 @@ void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data) _player->m_timeSyncClient = clientTicks; } -void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recvData*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_RESET_INSTANCES"); @@ -1483,12 +1458,12 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/) _player->ResetInstances(INSTANCE_RESET_ALL, false); } -void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_DUNGEON_DIFFICULTY"); uint32 mode; - recv_data >> mode; + recvData >> mode; if (mode >= MAX_DUNGEON_DIFFICULTY) { @@ -1503,7 +1478,8 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) Map* map = _player->FindMap(); if (map && map->IsDungeon()) { - sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", _player->GetName(), _player->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", + _player->GetName().c_str(), _player->GetGUIDLow()); return; } @@ -1523,7 +1499,8 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) if (groupGuy->GetMap()->IsNonRaidDungeon()) { - sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), groupGuy->GetName(), groupGuy->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", + _player->GetGUIDLow(), groupGuy->GetName().c_str(), groupGuy->GetGUIDLow()); return; } } @@ -1540,12 +1517,12 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) } } -void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_RAID_DIFFICULTY"); uint32 mode; - recv_data >> mode; + recvData >> mode; if (mode >= MAX_RAID_DIFFICULTY) { @@ -1597,7 +1574,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) } } -void WorldSession::HandleCancelMountAuraOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recvData*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_MOUNT_AURA"); @@ -1618,46 +1595,47 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPacket & /*recv_data*/) _player->RemoveAurasByType(SPELL_AURA_MOUNTED); } -void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data) +void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recvData) { // fly mode on/off sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); uint64 guid; // guid - unused - recv_data.readPackGUID(guid); + recvData.readPackGUID(guid); - recv_data.read_skip<uint32>(); // unk + recvData.read_skip<uint32>(); // unk MovementInfo movementInfo; movementInfo.guid = guid; - ReadMovementInfo(recv_data, &movementInfo); + ReadMovementInfo(recvData, &movementInfo); - recv_data.read_skip<float>(); // unk2 + recvData.read_skip<float>(); // unk2 _player->m_mover->m_movementInfo.flags = movementInfo.GetMovementFlags(); } -void WorldSession::HandleRequestPetInfoOpcode(WorldPacket & /*recv_data */) +void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recvData */) { /* sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_REQUEST_PET_INFO"); - recv_data.hexlike(); + recvData.hexlike(); */ } -void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket & recv_data) +void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recvData) { uint8 mode; - recv_data >> mode; + recvData >> mode; sLog->outDebug(LOG_FILTER_NETWORKIO, "Client used \"/timetest %d\" command", mode); } -void WorldSession::HandleQueryInspectAchievements(WorldPacket & recv_data) +void WorldSession::HandleQueryInspectAchievements(WorldPacket& recvData) { uint64 guid; - recv_data.readPackGUID(guid); + recvData.readPackGUID(guid); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_QUERY_INSPECT_ACHIEVEMENTS [" UI64FMTD "] Inspected Player [" UI64FMTD "]", _player->GetGUID(), guid); Player* player = ObjectAccessor::FindPlayer(guid); if (!player) return; @@ -1665,7 +1643,7 @@ void WorldSession::HandleQueryInspectAchievements(WorldPacket & recv_data) player->SendRespondInspectAchievements(_player); } -void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/) +void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recvData*/) { // empty opcode sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE"); @@ -1675,7 +1653,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/) SendPacket(&data); } -void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recv_data*/) +void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recvData*/) { // empty opcode sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES"); @@ -1690,14 +1668,14 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) SendPacket(&data); } // Battlefield and Battleground -void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) +void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); Battleground* bg = _player->GetBattleground(); uint64 guid; - recv_data >> guid; + recvData >> guid; Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) @@ -1713,14 +1691,14 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) bf->SendAreaSpiritHealerQueryOpcode(_player,guid); } -void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) +void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); Battleground* bg = _player->GetBattleground(); uint64 guid; - recv_data >> guid; + recvData >> guid; Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) @@ -1736,7 +1714,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) bf->AddPlayerToResurrectQueue(guid, _player->GetGUID()); } -void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/) +void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recvData*/) { if (_player->isInFlight()) return; @@ -1763,7 +1741,8 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) if (!_player->HasPendingBind()) { - sLog->outInfo(LOG_FILTER_NETWORKIO, "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName(), _player->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_NETWORKIO, "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", + _player->GetName().c_str(), _player->GetGUIDLow()); return; } diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 27b1f2eca3f..759a4359076 100755 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -46,7 +46,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SetSemaphoreTeleportFar(false); // get the teleport destination - WorldLocation const loc = GetPlayer()->GetTeleportDest(); + WorldLocation const& loc = GetPlayer()->GetTeleportDest(); // possible errors in the coordinate validity check if (!MapManager::IsValidMapCoord(loc)) @@ -66,7 +66,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() Map* oldMap = GetPlayer()->GetMap(); if (GetPlayer()->IsInWorld()) { - sLog->outError(LOG_FILTER_NETWORKIO, "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -89,7 +89,8 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SendInitialPacketsBeforeAddToMap(); if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer())) { - sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId()); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", + GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId()); GetPlayer()->ResetMap(); GetPlayer()->SetMap(oldMap); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); @@ -473,13 +474,13 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct { sLog->outError(LOG_FILTER_NETWORKIO, "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value", - move_type_name[move_type], _player->GetName(), _player->GetSpeed(move_type), newspeed); + move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed); _player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true); } else // must be lesser - cheating { sLog->outDebug(LOG_FILTER_GENERAL, "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)", - _player->GetName(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), newspeed); + _player->GetName().c_str(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), newspeed); _player->GetSession()->KickPlayer(); } } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 3501b3bc068..062927eebc0 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -44,7 +44,7 @@ void WorldSession::HandleDismissCritter(WorldPacket &recv_data) if (!pet) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", - uint32(GUID_LOPART(guid)), GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), GetAccountId()); + uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); return; } @@ -73,13 +73,13 @@ void WorldSession::HandlePetAction(WorldPacket & recv_data) if (!pet) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetFirstControlled()) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); return; } @@ -127,7 +127,8 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recv_data) if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm()) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", + uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } @@ -428,11 +429,9 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber) return; } - std::string name = pet->GetName(); - - WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+name.size()+1)); + WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+pet->GetName().size()+1)); data << uint32(petnumber); - data << name.c_str(); + data << pet->GetName(); data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP)); if (pet->isPet() && ((Pet*)pet)->GetDeclinedNames()) @@ -552,7 +551,8 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data) uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]); uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]); - sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state)); + sLog->outInfo(LOG_FILTER_NETWORKIO, "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", + _player->GetName().c_str(), position[i], spell_id, uint32(act_state)); //if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id))) @@ -717,7 +717,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm())) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } @@ -762,7 +762,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 90af03113bf..dd39973b37f 100755 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -269,7 +269,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recv_data) if (!result) { - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } Field* fields = result->Fetch(); @@ -479,7 +479,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) if (!result) { - sLog->outError(LOG_FILTER_NETWORKIO, "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } @@ -506,7 +506,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) { if (_player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName().c_str(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S); return; } @@ -516,13 +516,13 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) if (_player->GetArenaTeamId(slot)) { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_IN_ARENA_TEAM_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName().c_str(), ERR_ALREADY_IN_ARENA_TEAM_S); return; } if (_player->GetArenaTeamIdInvited()) { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName().c_str(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); return; } } @@ -530,12 +530,12 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) { if (_player->GetGuildId()) { - Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, _player->GetName()); + Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, _player->GetName().c_str()); return; } if (_player->GetGuildIdInvited()) { - Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName()); + Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName().c_str()); return; } } @@ -577,7 +577,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) CharacterDatabase.Execute(stmt); - sLog->outDebug(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName(), playerGuid, GetAccountId()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId()); WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8+8+4)); data << uint64(petitionGuid); @@ -671,7 +671,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { // player is too low level to join an arena team - SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ARENA_TEAM_TARGET_TOO_LOW_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName().c_str(), "", ERR_ARENA_TEAM_TARGET_TOO_LOW_S); return; } @@ -682,13 +682,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) if (player->GetArenaTeamId(slot)) { // player is already in an arena team - SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName(), "", ERR_ALREADY_IN_ARENA_TEAM_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, player->GetName().c_str(), "", ERR_ALREADY_IN_ARENA_TEAM_S); return; } if (player->GetArenaTeamIdInvited()) { - SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", _player->GetName().c_str(), ERR_ALREADY_INVITED_TO_ARENA_TEAM_S); return; } } @@ -696,13 +696,13 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) { if (player->GetGuildId()) { - Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, _player->GetName()); + Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_IN_GUILD_S, _player->GetName().c_str()); return; } if (player->GetGuildIdInvited()) { - Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName()); + Guild::SendCommandResult(this, GUILD_INVITE_S, ERR_ALREADY_INVITED_TO_GUILD_S, _player->GetName().c_str()); return; } } @@ -771,7 +771,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) } else { - sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); return; } diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index b16459a48b0..85f55fa7374 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -289,7 +289,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) if (reward >= QUEST_REWARD_CHOICES_COUNT) { - sLog->outError(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName(), _player->GetGUIDLow(), reward); + sLog->outError(LOG_FILTER_NETWORKIO, "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName().c_str(), _player->GetGUIDLow(), reward); return; } @@ -309,7 +309,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data) (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete())) { sLog->outError(LOG_FILTER_NETWORKIO, "HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!", - _player->GetName(), _player->GetGUIDLow(), questId); + _player->GetName().c_str(), _player->GetGUIDLow(), questId); return; } if (_player->CanRewardQuest(quest, reward, true)) @@ -501,7 +501,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) { sLog->outError(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!", - _player->GetName(), _player->GetGUIDLow(), questId); + _player->GetName().c_str(), _player->GetGUIDLow(), questId); return; } // TODO: need a virtual function diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 0e5d68d51e4..ad57fd799af 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -208,7 +208,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) { pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, NULL); sLog->outError(LOG_FILTER_NETWORKIO, "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!", - pUser->GetName(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId); + pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId); return; } @@ -453,13 +453,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) if (!pet) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm()) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 7fcfbbbc23e..41e834d84e8 100755 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -86,7 +86,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) sTicketMgr->AddTicket(ticket); sTicketMgr->UpdateLastChange(); - sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName(), ticket->GetId()); + sWorld->SendGMText(LANG_COMMAND_TICKETNEW, GetPlayer()->GetName().c_str(), ticket->GetId()); response = GMTICKET_RESPONSE_CREATE_SUCCESS; } @@ -96,10 +96,10 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) SendPacket(&data); } -void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data) +void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recvData) { std::string message; - recv_data >> message; + recvData >> message; GMTicketResponse response = GMTICKET_RESPONSE_UPDATE_ERROR; if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) @@ -108,7 +108,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data) ticket->SetMessage(message); ticket->SaveToDB(trans); - sWorld->SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName(), ticket->GetId()); + sWorld->SendGMText(LANG_COMMAND_TICKETUPDATED, GetPlayer()->GetName().c_str(), ticket->GetId()); response = GMTICKET_RESPONSE_UPDATE_SUCCESS; } @@ -118,7 +118,7 @@ void WorldSession::HandleGMTicketUpdateOpcode(WorldPacket & recv_data) SendPacket(&data); } -void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recvData*/) { if (GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) { @@ -126,14 +126,14 @@ void WorldSession::HandleGMTicketDeleteOpcode(WorldPacket & /*recv_data*/) data << uint32(GMTICKET_RESPONSE_TICKET_DELETED); SendPacket(&data); - sWorld->SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName(), ticket->GetId()); + sWorld->SendGMText(LANG_COMMAND_TICKETPLAYERABANDON, GetPlayer()->GetName().c_str(), ticket->GetId()); sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID()); sTicketMgr->SendTicket(this, NULL); } } -void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recvData*/) { SendQueryTimeResponse(); @@ -148,7 +148,7 @@ void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket & /*recv_data*/) sTicketMgr->SendTicket(this, NULL); } -void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recv_data*/) +void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recvData*/) { // Note: This only disables the ticket UI at client side and is not fully reliable // are we sure this is a uint32? Should ask Zor @@ -157,25 +157,25 @@ void WorldSession::HandleGMTicketSystemStatusOpcode(WorldPacket & /*recv_data*/) SendPacket(&data); } -void WorldSession::HandleGMSurveySubmit(WorldPacket& recv_data) +void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData) { uint32 nextSurveyID = sTicketMgr->GetNextSurveyID(); // just put the survey into the database uint32 mainSurvey; // GMSurveyCurrentSurvey.dbc, column 1 (all 9) ref to GMSurveySurveys.dbc - recv_data >> mainSurvey; + recvData >> mainSurvey; // sub_survey1, r1, comment1, sub_survey2, r2, comment2, sub_survey3, r3, comment3, sub_survey4, r4, comment4, sub_survey5, r5, comment5, sub_survey6, r6, comment6, sub_survey7, r7, comment7, sub_survey8, r8, comment8, sub_survey9, r9, comment9, sub_survey10, r10, comment10, for (uint8 i = 0; i < 10; i++) { uint32 subSurveyId; // ref to i'th GMSurveySurveys.dbc field (all fields in that dbc point to fields in GMSurveyQuestions.dbc) - recv_data >> subSurveyId; + recvData >> subSurveyId; if (!subSurveyId) break; uint8 rank; // probably some sort of ref to GMSurveyAnswers.dbc - recv_data >> rank; + recvData >> rank; std::string comment; // comment ("Usage: GMSurveyAnswerSubmit(question, rank, comment)") - recv_data >> comment; + recvData >> comment; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SUBSURVEY); stmt->setUInt32(0, nextSurveyID); @@ -186,7 +186,7 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recv_data) } std::string comment; // just a guess - recv_data >> comment; + recvData >> comment; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SURVEY); stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID())); @@ -197,17 +197,17 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recv_data) CharacterDatabase.Execute(stmt); } -void WorldSession::HandleReportLag(WorldPacket& recv_data) +void WorldSession::HandleReportLag(WorldPacket& recvData) { // just put the lag report into the database... // can't think of anything else to do with it uint32 lagType, mapId; - recv_data >> lagType; - recv_data >> mapId; + recvData >> lagType; + recvData >> mapId; float x, y, z; - recv_data >> x; - recv_data >> y; - recv_data >> z; + recvData >> x; + recvData >> y; + recvData >> z; PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT); stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID())); diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index f50b9ebd311..08f2d61826e 100755 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -155,9 +155,9 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", - _player->GetName(), _player->GetSession()->GetAccountId(), + _player->GetName().c_str(), _player->GetSession()->GetAccountId(), myItems[i]->GetTemplate()->Name1.c_str(), myItems[i]->GetEntry(), myItems[i]->GetCount(), - trader->GetName(), trader->GetSession()->GetAccountId()); + trader->GetName().c_str(), trader->GetSession()->GetAccountId()); } // adjust time (depends on /played) @@ -173,9 +173,9 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", - trader->GetName(), trader->GetSession()->GetAccountId(), + trader->GetName().c_str(), trader->GetSession()->GetAccountId(), hisItems[i]->GetTemplate()->Name1.c_str(), hisItems[i]->GetEntry(), hisItems[i]->GetCount(), - _player->GetName(), _player->GetSession()->GetAccountId()); + _player->GetName().c_str(), _player->GetSession()->GetAccountId()); } // adjust time (depends on /played) @@ -463,16 +463,16 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && my_trade->GetMoney() > 0) { sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", - _player->GetName(), _player->GetSession()->GetAccountId(), + _player->GetName().c_str(), _player->GetSession()->GetAccountId(), my_trade->GetMoney(), - trader->GetName(), trader->GetSession()->GetAccountId()); + trader->GetName().c_str(), trader->GetSession()->GetAccountId()); } if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && his_trade->GetMoney() > 0) { sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", - trader->GetName(), trader->GetSession()->GetAccountId(), + trader->GetName().c_str(), trader->GetSession()->GetAccountId(), his_trade->GetMoney(), - _player->GetName(), _player->GetSession()->GetAccountId()); + _player->GetName().c_str(), _player->GetSession()->GetAccountId()); } } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 51435d6df9b..5ef0769e5c2 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -715,7 +715,7 @@ void Map::PlayerRelocation(Player* player, float x, float y, float z, float orie if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell)) { - sLog->outDebug(LOG_FILTER_MAPS, "Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); + sLog->outDebug(LOG_FILTER_MAPS, "Player %s relocation grid[%u, %u]cell[%u, %u]->grid[%u, %u]cell[%u, %u]", player->GetName().c_str(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY()); player->RemoveFromGrid(); @@ -1016,7 +1016,7 @@ void Map::RemoveAllPlayers() if (!player->IsBeingTeleportedFar()) { // this is happening for bg - sLog->outError(LOG_FILTER_MAPS, "Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName(), GetId()); + sLog->outError(LOG_FILTER_MAPS, "Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName().c_str(), GetId()); player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); } } @@ -2311,7 +2311,7 @@ bool InstanceMap::CanEnter(Player* player) { if (player->GetMapRef().getTarget() == this) { - sLog->outError(LOG_FILTER_MAPS, "InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); ASSERT(false); return false; } @@ -2324,7 +2324,7 @@ bool InstanceMap::CanEnter(Player* player) uint32 maxPlayers = GetMaxPlayers(); if (GetPlayersCountExceptGMs() >= maxPlayers) { - sLog->outInfo(LOG_FILTER_MAPS, "MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName()); + sLog->outInfo(LOG_FILTER_MAPS, "MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName().c_str()); player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); return false; } @@ -2405,7 +2405,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot enter other instances if bound permanently if (playerBind->save != mapSave) { - sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d, %d, %d", player->GetName(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); return false; } } @@ -2417,7 +2417,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceGroupBind* groupBind = group->GetBoundInstance(this); if (playerBind && playerBind->save != mapSave) { - sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); if (groupBind) sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: the group is bound to the instance %d, %d, %d, %d, %d, %d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); //ASSERT(false); @@ -2431,7 +2431,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot jump to a different instance without resetting it if (groupBind->save != mapSave) { - sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d but he is in group %d which is bound to instance %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), GUID_LOPART(group->GetLeaderGUID()), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty()); if (mapSave) sLog->outError(LOG_FILTER_MAPS, "MapSave players: %d, group count: %d", mapSave->GetPlayerCount(), mapSave->GetGroupCount()); else @@ -2478,7 +2478,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // first player enters (no players yet) SetResetSchedule(false); - sLog->outInfo(LOG_FILTER_MAPS, "MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName(), GetInstanceId(), GetMapName()); + sLog->outInfo(LOG_FILTER_MAPS, "MAP: Player '%s' entered instance '%u' of map '%s'", player->GetName().c_str(), GetInstanceId(), GetMapName()); // initialize unload state m_unloadTimer = 0; m_resetAfterUnload = false; @@ -2504,7 +2504,7 @@ void InstanceMap::Update(const uint32 t_diff) void InstanceMap::RemovePlayerFromMap(Player* player, bool remove) { - sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName()); + sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from instance '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName()); //if last player set unload timer if (!m_unloadTimer && m_mapRefManager.getSize() == 1) m_unloadTimer = m_unloadWhenEmpty ? MIN_UNLOAD_DELAY : std::max(sWorld->getIntConfig(CONFIG_INSTANCE_UNLOAD_DELAY), (uint32)MIN_UNLOAD_DELAY); @@ -2599,7 +2599,7 @@ void InstanceMap::PermBindAllPlayers(Player* source) InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!save) { - sLog->outError(LOG_FILTER_MAPS, "Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId()); + sLog->outError(LOG_FILTER_MAPS, "Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", source->GetGUIDLow(), source->GetName().c_str(), source->GetMap()->GetMapName(), source->GetMapId(), GetInstanceId()); return; } @@ -2743,7 +2743,7 @@ bool BattlegroundMap::AddPlayerToMap(Player* player) void BattlegroundMap::RemovePlayerFromMap(Player* player, bool remove) { - sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName(), GetInstanceId(), GetMapName()); + sLog->outInfo(LOG_FILTER_MAPS, "MAP: Removing player '%s' from bg '%u' of map '%s' before relocating to another map", player->GetName().c_str(), GetInstanceId(), GetMapName()); Map::RemovePlayerFromMap(player, remove); } diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index b49d7db0a27..f6aa6ff7dc3 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -192,7 +192,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) // probably there must be special opcode, because client has this string constant in GlobalStrings.lua // TODO: this is not a good place to send the message player->GetSession()->SendAreaTriggerMessage(player->GetSession()->GetTrinityString(LANG_INSTANCE_RAID_GROUP_ONLY), mapName); - sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName(), mapName); + sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName().c_str(), mapName); return false; } } @@ -216,15 +216,15 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) { WorldPacket data(SMSG_CORPSE_NOT_IN_INSTANCE); player->GetSession()->SendPacket(&data); - sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName(), mapName); + sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName().c_str(), mapName); return false; } - sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName(), mapName); + sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName().c_str(), mapName); player->ResurrectPlayer(0.5f, false); player->SpawnCorpseBones(); } else - sLog->outDebug(LOG_FILTER_MAPS, "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName()); + sLog->outDebug(LOG_FILTER_MAPS, "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName().c_str()); } //Get instance where player's group is bound & its map diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 26e83773228..488dbfc9159 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -44,7 +44,8 @@ void MotionMaster::Initialize() { MovementGenerator *curr = top(); pop(); - if (curr) DirectDelete(curr); + if (curr) + DirectDelete(curr); } InitDefault(); @@ -488,14 +489,14 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) { if (path < sTaxiPathNodesByPath.size()) { - sLog->outDebug(LOG_FILTER_GENERAL, "%s taxi to (Path %u node %u)", _owner->GetName(), path, pathnode); + sLog->outDebug(LOG_FILTER_GENERAL, "%s taxi to (Path %u node %u)", _owner->GetName().c_str(), path, pathnode); FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode); Mutate(mgen, MOTION_SLOT_CONTROLLED); } else { sLog->outError(LOG_FILTER_GENERAL, "%s attempt taxi to (not existed Path %u node %u)", - _owner->GetName(), path, pathnode); + _owner->GetName().c_str(), path, pathnode); } } else diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 12b85b10922..37a1fa84d80 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -41,7 +41,7 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature &creature) if (!i_path) { // No movement found for entry - sLog->outError(LOG_FILTER_SQL, "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature.GetName(), creature.GetEntry(), creature.GetGUIDLow(), path_id); + sLog->outError(LOG_FILTER_SQL, "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature.GetName().c_str(), creature.GetEntry(), creature.GetGUIDLow(), path_id); return; } @@ -283,7 +283,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player& player, TaxiPathNodeEntry { if (uint32 eventid = departure ? node.departureEventID : node.arrivalEventID) { - sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.index, node.path, player.GetName()); + sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.index, node.path, player.GetName().c_str()); player.GetMap()->ScriptsStart(sEventScripts, eventid, &player, &player); } } diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 6985cb92804..5e3d37acb71 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -29,12 +29,11 @@ #include "GridNotifiersImpl.h" #include "CellImpl.h" -OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp) : -m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0), -m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL), -m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp) -{ -} +OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp): + m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0), + m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL), + m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp) +{ } bool OPvPCapturePoint::HandlePlayerEnter(Player* player) { @@ -44,14 +43,14 @@ bool OPvPCapturePoint::HandlePlayerEnter(Player* player) player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)); player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct); } - return m_activePlayers[player->GetTeamId()].insert(player).second; + return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second; } void OPvPCapturePoint::HandlePlayerLeave(Player* player) { if (m_capturePoint) player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - m_activePlayers[player->GetTeamId()].erase(player); + m_activePlayers[player->GetTeamId()].erase(player->GetGUID()); } void OPvPCapturePoint::SendChangePhase() @@ -243,7 +242,7 @@ OutdoorPvP::~OutdoorPvP() void OutdoorPvP::HandlePlayerEnterZone(Player* player, uint32 /*zone*/) { - m_players[player->GetTeamId()].insert(player); + m_players[player->GetTeamId()].insert(player->GetGUID()); } void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) @@ -254,8 +253,8 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) // remove the world state information from the player (we can't keep everyone up to date, so leave out those who are not in the concerning zones) if (!player->GetSession()->PlayerLogout()) SendRemoveWorldStates(player); - m_players[player->GetTeamId()].erase(player); - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName()); + m_players[player->GetTeamId()].erase(player->GetGUID()); + sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName().c_str()); } void OutdoorPvP::HandlePlayerResurrects(Player* /*player*/, uint32 /*zone*/) @@ -281,15 +280,10 @@ bool OPvPCapturePoint::Update(uint32 diff) float radius = (float)m_capturePoint->GetGOInfo()->capturePoint.radius; for (uint32 team = 0; team < 2; ++team) - { - for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) - { - Player* player = *itr; - ++itr; - if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) - HandlePlayerLeave(player); - } - } + for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) + if (Player* player = ObjectAccessor::FindPlayer(*itr)) + if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) + HandlePlayerLeave(player); std::list<Player*> players; Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); @@ -298,9 +292,10 @@ bool OPvPCapturePoint::Update(uint32 diff) for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr) { - if ((*itr)->IsOutdoorPvPActive()) + Player* const player = *itr; + if (player->IsOutdoorPvPActive()) { - if (m_activePlayers[(*itr)->GetTeamId()].insert(*itr).second) + if (m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second) HandlePlayerEnter(*itr); } } @@ -397,7 +392,8 @@ void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value) if (m_sendUpdate) for (int i = 0; i < 2; ++i) for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) - (*itr)->SendUpdateWorldState(field, value); + if (Player * const player = ObjectAccessor::FindPlayer(*itr)) + player->SendUpdateWorldState(field, value); } void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) @@ -406,9 +402,8 @@ void OPvPCapturePoint::SendUpdateWorldState(uint32 field, uint32 value) { // send to all players present in the area for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - { - (*itr)->SendUpdateWorldState(field, value); - } + if (Player * const player = ObjectAccessor::FindPlayer(*itr)) + player->SendUpdateWorldState(field, value); } } @@ -429,7 +424,8 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) // send to all players present in the area for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - (*itr)->KilledMonsterCredit(id, guid); + if (Player * const player = ObjectAccessor::FindPlayer(*itr)) + player->KilledMonsterCredit(id, guid); } void OutdoorPvP::HandleKill(Player* killer, Unit* killed) @@ -476,7 +472,8 @@ bool OutdoorPvP::IsInsideObjective(Player* player) const bool OPvPCapturePoint::IsInsideObjective(Player* player) const { - return m_activePlayers[player->GetTeamId()].find(player) != m_activePlayers[player->GetTeamId()].end(); + PlayerSet const &plSet = m_activePlayers[player->GetTeamId()]; + return plSet.find(player->GetGUID()) != plSet.end(); } bool OutdoorPvP::HandleCustomSpell(Player* player, uint32 spellId, GameObject* go) @@ -566,7 +563,8 @@ void OutdoorPvP::BroadcastPacket(WorldPacket &data) const // This is faster than sWorld->SendZoneMessage for (uint32 team = 0; team < 2; ++team) for (PlayerSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - (*itr)->GetSession()->SendPacket(&data); + if (Player * const player = ObjectAccessor::FindPlayer(*itr)) + player->GetSession()->SendPacket(&data); } void OutdoorPvP::RegisterZone(uint32 zoneId) @@ -574,19 +572,26 @@ void OutdoorPvP::RegisterZone(uint32 zoneId) sOutdoorPvPMgr->AddZone(zoneId, this); } -bool OutdoorPvP::HasPlayer(Player* player) const +bool OutdoorPvP::HasPlayer(Player const* player) const { - return m_players[player->GetTeamId()].find(player) != m_players[player->GetTeamId()].end(); + PlayerSet const &plSet = m_players[player->GetTeamId()]; + return plSet.find(player->GetGUID()) != plSet.end(); } void OutdoorPvP::TeamCastSpell(TeamId team, int32 spellId) { if (spellId > 0) + { for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - (*itr)->CastSpell(*itr, (uint32)spellId, true); + if (Player * const player = ObjectAccessor::FindPlayer(*itr)) + player->CastSpell(player, (uint32)spellId, true); + } else + { for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) - (*itr)->RemoveAura((uint32)-spellId); // by stack? + if (Player * const player = ObjectAccessor::FindPlayer(*itr)) + player->RemoveAura((uint32)-spellId); // by stack? + } } void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index e896fa2acf6..e9d5ff9dfdc 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -18,7 +18,7 @@ #ifndef OUTDOOR_PVP_H_ #define OUTDOOR_PVP_H_ -#include "Utilities/Util.h" +#include "Util.h" #include "SharedDefines.h" #include "ZoneScript.h" @@ -85,7 +85,7 @@ class Unit; struct GossipMenuItems; class OutdoorPvP; -typedef std::set<Player*> PlayerSet; +typedef std::set<uint64> PlayerSet; class OPvPCapturePoint { @@ -285,7 +285,7 @@ class OutdoorPvP : public ZoneScript void RegisterZone(uint32 zoneid); - bool HasPlayer(Player* player) const; + bool HasPlayer(Player const * player) const; void TeamCastSpell(TeamId team, int32 spellId); }; diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 5a8891d888c..58734751cea 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -222,18 +222,17 @@ class Quest uint32 GetSrcItemId() const { return SourceItemId; } uint32 GetSrcItemCount() const { return SourceItemIdCount; } uint32 GetSrcSpell() const { return SourceSpellid; } - std::string GetTitle() const { return Title; } - std::string GetDetails() const { return Details; } - std::string GetObjectives() const { return Objectives; } - std::string GetOfferRewardText() const { return OfferRewardText; } - std::string GetRequestItemsText() const { return RequestItemsText; } - std::string GetEndText() const { return EndText; } - std::string GetCompletedText() const { return CompletedText; } + std::string const& GetTitle() const { return Title; } + std::string const& GetDetails() const { return Details; } + std::string const& GetObjectives() const { return Objectives; } + std::string const& GetOfferRewardText() const { return OfferRewardText; } + std::string const& GetRequestItemsText() const { return RequestItemsText; } + std::string const& GetEndText() const { return EndText; } + std::string const& GetCompletedText() const { return CompletedText; } int32 GetRewOrReqMoney() const; uint32 GetRewHonorAddition() const { return RewardHonor; } float GetRewHonorMultiplier() const { return RewardHonorMultiplier; } - uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; } - // use in XP calculation at client + uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; } // use in XP calculation at client uint32 GetRewSpell() const { return RewardSpell; } int32 GetRewSpellCast() const { return RewardSpellCast; } uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; } diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 7ef59916099..356a70ba6a5 100755 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -45,7 +45,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const if (!factionEntry) { - sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id); + sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); return 0; } @@ -68,7 +68,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const if (!factionEntry) { - sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id); + sLog->outError(LOG_FILTER_GENERAL, "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); return 0; } diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index a3a850ff1c1..855ff036619 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -545,7 +545,8 @@ void WorldSession::LogoutPlayer(bool Save) // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); - sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", + GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel()); if (Map* _map = _player->FindMap()) _map->RemovePlayerFromMap(_player, true); diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 92455f8edfe..9b4465aa6e1 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -483,7 +483,7 @@ int WorldSocket::handle_input_header (void) sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, - _player ? _player->GetName() : "<none>", + _player ? _player->GetName().c_str() : "<none>", header.size, header.cmd); errno = EINVAL; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 9c08ebae5ac..d0d9d417c3e 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -567,8 +567,8 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) { //TODO: There is a crash caused by shadowfiend load addon sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id, - GetOwner()->GetName(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1), - itr->first->GetName(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1)); + GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1), + itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1)); ASSERT(false); } itr->first->_CreateAuraApplication(this, itr->second); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 8790bf035cc..86fc27af1f2 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4299,13 +4299,15 @@ void Spell::SendResurrectRequest(Player* target) { // get ressurector name for creature resurrections, otherwise packet will be not accepted // for player resurrections the name is looked up by guid - char const* resurrectorName = m_caster->GetTypeId() == TYPEID_PLAYER ? "" : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()); + std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER + ? "" + : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex())); - WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+strlen(resurrectorName)+1+1+1+4)); - data << uint64(m_caster->GetGUID()); // resurrector guid - data << uint32(strlen(resurrectorName) + 1); + WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+sentName.size()+1+1+1+4)); + data << uint64(m_caster->GetGUID()); + data << uint32(sentName.size() + 1); - data << resurrectorName; + data << sentName; data << uint8(0); // null terminator data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1); // "you'll be afflicted with resurrection sickness" diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 1688d3a8e69..6709bde541b 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1988,7 +1988,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) if (!gameObjTarget->isSpawned() && !player->isGameMaster()) { sLog->outError(LOG_FILTER_SPELLS_AURAS, "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!", - player->GetName(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow()); + player->GetName().c_str(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow()); return; } // special case, already has GossipHello inside so return and avoid calling twice @@ -2798,9 +2798,9 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", - p_caster->GetName(), p_caster->GetSession()->GetAccountId(), + p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(), itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(), - item_owner->GetName(), item_owner->GetSession()->GetAccountId()); + item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped @@ -2863,9 +2863,9 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", - p_caster->GetName(), p_caster->GetSession()->GetAccountId(), + p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(), itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(), - item_owner->GetName(), item_owner->GetSession()->GetAccountId()); + item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped @@ -2997,9 +2997,9 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(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(), + p_caster->GetName().c_str(), p_caster->GetSession()->GetAccountId(), itemTarget->GetTemplate()->Name1.c_str(), itemTarget->GetEntry(), - item_owner->GetName(), item_owner->GetSession()->GetAccountId()); + item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped @@ -3928,7 +3928,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) const char *gender = "his"; if (m_caster->getGender() > 0) gender = "her"; - sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName(), gender, gender, urand(1, 10), urand(1, 10)); + sprintf(buf, "%s rubs %s [Decahedral Dwarven Dice] between %s hands and rolls. One %u and one %u.", m_caster->GetName().c_str(), gender, gender, urand(1, 10), urand(1, 10)); m_caster->MonsterTextEmote(buf, 0); break; } @@ -3939,7 +3939,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) const char *gender = "his"; if (m_caster->getGender() > 0) gender = "her"; - sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName(), gender, urand(1, 6), urand(1, 6)); + sprintf(buf, "%s causually tosses %s [Worn Troll Dice]. One %u and one %u.", m_caster->GetName().c_str(), gender, urand(1, 6), urand(1, 6)); m_caster->MonsterTextEmote(buf, 0); break; } @@ -4549,7 +4549,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/) Player* target = (Player*)m_caster; sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell Effect: Stuck"); - sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", target->GetName(), target->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); + sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", target->GetName().c_str(), target->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); if (target->isInFlight()) return; diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 7818527b34b..5c2639175d2 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -34,14 +34,14 @@ class CreatureTextBuilder size_t operator()(WorldPacket* data, LocaleConstant locale) const { - std::string text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale); - char const* localizedName = _source->GetNameForLocaleIdx(locale); + std::string const& text = sCreatureTextMgr->GetLocalizedChatString(_source->GetEntry(), _textGroup, _textId, locale); + std::string const& localizedName = _source->GetNameForLocaleIdx(locale); *data << uint8(_msgType); *data << uint32(_language); *data << uint64(_source->GetGUID()); *data << uint32(1); // 2.1.0 - *data << uint32(strlen(localizedName)+1); + *data << uint32(localizedName.size() + 1); *data << localizedName; size_t whisperGUIDpos = data->wpos(); *data << uint64(_targetGUID); // Unit Target @@ -178,7 +178,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp CreatureTextMap::const_iterator sList = mTextMap.find(source->GetEntry()); if (sList == mTextMap.end()) { - sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName(), source->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName().c_str(), source->GetEntry()); return 0; } @@ -186,7 +186,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, uint64 whisp CreatureTextHolder::const_iterator itr = textHolder.find(textGroup); if (itr == textHolder.end()) { - sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry()); + sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry()); return 0; } @@ -383,7 +383,7 @@ void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id) if (std::find(repeats.begin(), repeats.end(), id) == repeats.end()) repeats.push_back(id); else - sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); + sLog->outError(LOG_FILTER_SQL, "CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); } CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 4949f904a57..10a1581906f 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -2267,7 +2267,7 @@ void World::KickAllLess(AccountTypes sec) } /// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban -BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author) +BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, std::string const& duration, std::string const& reason, std::string const& author) { uint32 duration_secs = TimeStringToSecs(duration); PreparedQueryResult resultAccounts = PreparedQueryResult(NULL); //used for kicking @@ -2345,7 +2345,7 @@ BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string dura } /// Remove a ban from an account or IP address -bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP) +bool World::RemoveBanAccount(BanMode mode, std::string const& nameOrIP) { PreparedStatement* stmt = NULL; if (mode == BAN_IP) @@ -2374,9 +2374,9 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP) } /// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban -BanReturn World::BanCharacter(std::string name, std::string duration, std::string reason, std::string author) +BanReturn World::BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author) { - Player* pBanned = sObjectAccessor->FindPlayerByName(name.c_str()); + Player* pBanned = sObjectAccessor->FindPlayerByName(name); uint32 guid = 0; uint32 duration_secs = TimeStringToSecs(duration); @@ -2415,9 +2415,9 @@ BanReturn World::BanCharacter(std::string name, std::string duration, std::strin } /// Remove a ban from a character -bool World::RemoveBanCharacter(std::string name) +bool World::RemoveBanCharacter(std::string const& name) { - Player* pBanned = sObjectAccessor->FindPlayerByName(name.c_str()); + Player* pBanned = sObjectAccessor->FindPlayerByName(name); uint32 guid = 0; /// Pick a player to ban if not online diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 470059eb86b..9a0246fb3ac 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -720,10 +720,10 @@ class World void KickAll(); void KickAllLess(AccountTypes sec); - BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); - bool RemoveBanAccount(BanMode mode, std::string nameOrIP); - BanReturn BanCharacter(std::string name, std::string duration, std::string reason, std::string author); - bool RemoveBanCharacter(std::string name); + BanReturn BanAccount(BanMode mode, std::string const& nameOrIP, std::string const& duration, std::string const& reason, std::string const& author); + bool RemoveBanAccount(BanMode mode, std::string const& nameOrIP); + BanReturn BanCharacter(std::string const& name, std::string const& duration, std::string const& reason, std::string const& author); + bool RemoveBanCharacter(std::string const& name); // for max speed access static float GetMaxVisibleDistanceOnContinents() { return m_MaxVisibleDistanceOnContinents; } diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 1024a3acf15..15a724e69d1 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -111,9 +111,9 @@ public: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) { - sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password." - , handler->GetSession()->GetAccountId(),handler->GetSession()->GetRemoteAddress().c_str() - , handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUIDLow()); + sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", + handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), + handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); } break; case AOR_NAME_TOO_LONG: diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 1f32368adfd..2202edbe4aa 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -265,7 +265,7 @@ public: return false; LocaleConstant loc = handler->GetSessionDbcLocale(); - char const* targetName = target->GetName(); + char const* targetName = target->GetName().c_str(); char const* knownStr = handler->GetTrinityString(LANG_KNOWN); // Search in CharTitles.dbc @@ -681,7 +681,7 @@ public: uint64 characterGuid; uint32 accountId; - Player* player = sObjectAccessor->FindPlayerByName(characterName.c_str()); + Player* player = sObjectAccessor->FindPlayerByName(characterName); if (player) { characterGuid = player->GetGUID(); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 7f25a11bcdd..1ec283b7014 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -417,7 +417,7 @@ public: sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending opcode %u", data.GetOpcode()); data.hexlike(); player->GetSession()->SendPacket(&data); - handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName()); + handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str()); return true; } @@ -496,7 +496,9 @@ public: if (!target) return false; - handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s", target->GetName(), target->GetGUIDLow(), target->GetDBTableGUIDLow(), target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName() : "offline") : "no loot recipient"); + handler->PSendSysMessage("Loot recipient for creature %s (GUID %u, DB GUID %u) is %s", + target->GetName().c_str(), target->GetGUIDLow(), target->GetDBTableGUIDLow(), + target->hasLootRecipient() ? (target->GetLootRecipient() ? target->GetLootRecipient()->GetName().c_str() : "offline") : "no loot recipient"); return true; } @@ -799,14 +801,14 @@ public: std::list<HostileReference*>& threatList = target->getThreatManager().getThreatList(); std::list<HostileReference*>::iterator itr; uint32 count = 0; - handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName(), target->GetGUIDLow()); + handler->PSendSysMessage("Threat list of %s (guid %u)", target->GetName().c_str(), target->GetGUIDLow()); for (itr = threatList.begin(); itr != threatList.end(); ++itr) { Unit* unit = (*itr)->getTarget(); if (!unit) continue; ++count; - handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), (*itr)->getThreat()); + handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUIDLow(), (*itr)->getThreat()); } handler->SendSysMessage("End of threat list."); return true; @@ -819,13 +821,13 @@ public: target = handler->GetSession()->GetPlayer(); HostileReference* ref = target->getHostileRefManager().getFirst(); uint32 count = 0; - handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName(), target->GetGUIDLow()); + handler->PSendSysMessage("Hostil reference list of %s (guid %u)", target->GetName().c_str(), target->GetGUIDLow()); while (ref) { if (Unit* unit = ref->getSource()->getOwner()) { ++count; - handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName(), unit->GetGUIDLow(), ref->getThreat()); + handler->PSendSysMessage(" %u. %s (guid %u) - threat %f", count, unit->GetName().c_str(), unit->GetGUIDLow(), ref->getThreat()); } ref = ref->next(); } @@ -1047,7 +1049,7 @@ public: static bool HandleDebugLoSCommand(ChatHandler* handler, char const* /*args*/) { if (Unit* unit = handler->getSelectedUnit()) - handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not "); + handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName().c_str(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not "); return true; } diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index 3dfc6f9c7e8..4c6e36d3f71 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -133,16 +133,17 @@ public: handler->SendSysMessage(LANG_GMS_ON_SRV); handler->SendSysMessage("========================"); } - char const* name = itr->second->GetName(); + std::string const& name = itr->second->GetName(); + uint8 size = name.size(); uint8 security = itrSec; - uint8 max = ((16 - strlen(name)) / 2); + uint8 max = ((16 - size) / 2); uint8 max2 = max; - if ((max + max2 + strlen(name)) == 16) + if ((max + max2 + size) == 16) max2 = max - 1; if (handler->GetSession()) - handler->PSendSysMessage("| %s GMLevel %u", name, security); + handler->PSendSysMessage("| %s GMLevel %u", name.c_str(), security); else - handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name, max2, " ", security); + handler->PSendSysMessage("|%*s%s%*s| %u |", max, " ", name.c_str(), max2, " ", security); } } if (footer) diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index 45ecc4e4721..e07458ac691 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -29,7 +29,7 @@ void GetPlayerInfo(ChatHandler* handler, Player* player) LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid); char const * const state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid)); - handler->PSendSysMessage(LANG_LFG_PLAYER_INFO, player->GetName(), + handler->PSendSysMessage(LANG_LFG_PLAYER_INFO, player->GetName().c_str(), state, uint8(dungeons.size()), sLFGMgr->ConcatenateDungeons(dungeons).c_str(), sLFGMgr->GetRolesString(sLFGMgr->GetRoles(guid)).c_str(), sLFGMgr->GetComment(guid).c_str()); } diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 951ebc7714b..8f7e3ed3247 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1081,7 +1081,7 @@ public: Player* target = handler->getSelectedPlayer(); // title name have single string arg for player name - char const* targetName = target ? target->GetName() : "NAME"; + char const* targetName = target ? target->GetName().c_str() : "NAME"; std::string namePart = args; std::wstring wNamePart; diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index d61abf34e2f..de2fcf26943 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -71,7 +71,7 @@ public: Player* player = handler->GetSession()->GetPlayer(); Channel* channcel = NULL; - if (ChannelMgr* cMgr = channelMgr(player->GetTeam())) + if (ChannelMgr* cMgr = ChannelMgr::forTeam(player->GetTeam())) channcel = cMgr->GetChannel(channelStr, player); if (strcmp(argStr, "on") == 0) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index f7280cf906e..7e460c7482f 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1923,9 +1923,9 @@ public: if (!target) handler->SendSysMessage(LANG_MOVEGENS_CHASE_NULL); else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName(), target->GetGUIDLow()); + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_PLAYER, target->GetName().c_str(), target->GetGUIDLow()); else - handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName(), target->GetGUIDLow()); + handler->PSendSysMessage(LANG_MOVEGENS_CHASE_CREATURE, target->GetName().c_str(), target->GetGUIDLow()); break; } case FOLLOW_MOTION_TYPE: @@ -1939,9 +1939,9 @@ public: if (!target) handler->SendSysMessage(LANG_MOVEGENS_FOLLOW_NULL); else if (target->GetTypeId() == TYPEID_PLAYER) - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName(), target->GetGUIDLow()); + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_PLAYER, target->GetName().c_str(), target->GetGUIDLow()); else - handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName(), target->GetGUIDLow()); + handler->PSendSysMessage(LANG_MOVEGENS_FOLLOW_CREATURE, target->GetName().c_str(), target->GetGUIDLow()); break; } case HOME_MOTION_TYPE: @@ -2534,7 +2534,7 @@ public: { name = TargetName; normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); + player = sObjectAccessor->FindPlayerByName(name); } if (!player) @@ -2593,7 +2593,7 @@ public: { name = targetName; normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name.c_str()); + player = sObjectAccessor->FindPlayerByName(name); } else // If no name was entered - use target { diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 77fc2918e0b..ba7342caa80 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -47,19 +47,19 @@ public: { "weapon", SEC_ADMINISTRATOR, false, &HandleNpcAddWeaponCommand, "", NULL }, //} { "", SEC_GAMEMASTER, false, &HandleNpcAddCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand npcDeleteCommandTable[] = { { "item", SEC_GAMEMASTER, false, &HandleNpcDeleteVendorItemCommand, "", NULL }, { "", SEC_GAMEMASTER, false, &HandleNpcDeleteCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand npcFollowCommandTable[] = { { "stop", SEC_GAMEMASTER, false, &HandleNpcUnFollowCommand, "", NULL }, { "", SEC_GAMEMASTER, false, &HandleNpcFollowCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand npcSetCommandTable[] = { @@ -79,7 +79,7 @@ public: { "name", SEC_GAMEMASTER, false, &HandleNpcSetNameCommand, "", NULL }, { "subname", SEC_GAMEMASTER, false, &HandleNpcSetSubNameCommand, "", NULL }, //} - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand npcCommandTable[] = { @@ -95,18 +95,18 @@ public: { "delete", SEC_GAMEMASTER, false, NULL, "", npcDeleteCommandTable }, { "follow", SEC_GAMEMASTER, false, NULL, "", npcFollowCommandTable }, { "set", SEC_GAMEMASTER, false, NULL, "", npcSetCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { { "npc", SEC_MODERATOR, false, NULL, "", npcCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; } //add spawn of creature - static bool HandleNpcAddCommand(ChatHandler* handler, const char* args) + static bool HandleNpcAddCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -229,7 +229,7 @@ public: } //add move for creature - static bool HandleNpcAddMoveCommand(ChatHandler* handler, const char* args) + static bool HandleNpcAddMoveCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -293,7 +293,7 @@ public: return true; } - static bool HandleNpcSetAllowMovementCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleNpcSetAllowMovementCommand(ChatHandler* handler, char const* /*args*/) { if (sWorld->getAllowMovement()) { @@ -308,7 +308,7 @@ public: return true; } - static bool HandleNpcSetEntryCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetEntryCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -333,7 +333,7 @@ public: } //change level of creature or pet - static bool HandleNpcSetLevelCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetLevelCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -374,7 +374,7 @@ public: return true; } - static bool HandleNpcDeleteCommand(ChatHandler* handler, const char* args) + static bool HandleNpcDeleteCommand(ChatHandler* handler, char const* args) { Creature* unit = NULL; @@ -413,7 +413,7 @@ public: } //del item from vendor list - static bool HandleNpcDeleteVendorItemCommand(ChatHandler* handler, const char* args) + static bool HandleNpcDeleteVendorItemCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -449,7 +449,7 @@ public: } //set faction of creature - static bool HandleNpcSetFactionIdCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetFactionIdCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -496,7 +496,7 @@ public: } //set npcflag of creature - static bool HandleNpcSetFlagCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetFlagCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -527,7 +527,7 @@ public: } //set data of creature for testing scripting - static bool HandleNpcSetDataCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetDataCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -555,12 +555,12 @@ public: creature->AI()->SetData(data_1, data_2); std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set"); - handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName(), data_1, data_2, AIorScript.c_str()); + handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str()); return true; } //npc follow handling - static bool HandleNpcFollowCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleNpcFollowCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); Creature* creature = handler->getSelectedCreature(); @@ -575,11 +575,11 @@ public: // Follow player - Using pet's default dist and angle creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, creature->GetFollowAngle()); - handler->PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName()); + handler->PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName().c_str()); return true; } - static bool HandleNpcInfoCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleNpcInfoCommand(ChatHandler* handler, char const* /*args*/) { Creature* target = handler->getSelectedCreature(); @@ -625,7 +625,7 @@ public: } //move selected creature - static bool HandleNpcMoveCommand(ChatHandler* handler, const char* args) + static bool HandleNpcMoveCommand(ChatHandler* handler, char const* args) { uint32 lowguid = 0; @@ -713,7 +713,7 @@ public: } //play npc emote - static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, const char* args) + static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, char const* args) { uint32 emote = atoi((char*)args); @@ -742,7 +742,7 @@ public: } //set model of creature - static bool HandleNpcSetModelCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetModelCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -778,7 +778,7 @@ public: * additional parameter: NODEL - so no waypoints are deleted, if you * change the movement type */ - static bool HandleNpcSetMoveTypeCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetMoveTypeCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -914,7 +914,7 @@ public: //npc phasemask handling //change phasemask of creature or pet - static bool HandleNpcSetPhaseCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetPhaseCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -944,7 +944,7 @@ public: } //set spawn dist of creature - static bool HandleNpcSetSpawnDistCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetSpawnDistCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -990,7 +990,7 @@ public: } //spawn time handling - static bool HandleNpcSetSpawnTimeCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetSpawnTimeCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1030,7 +1030,7 @@ public: return true; } - static bool HandleNpcSayCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSayCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1058,7 +1058,7 @@ public: } //show text emote by creature in chat - static bool HandleNpcTextEmoteCommand(ChatHandler* handler, const char* args) + static bool HandleNpcTextEmoteCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1078,7 +1078,7 @@ public: } //npc unfollow handling - static bool HandleNpcUnFollowCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleNpcUnFollowCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); Creature* creature = handler->getSelectedCreature(); @@ -1093,7 +1093,7 @@ public: if (/*creature->GetMotionMaster()->empty() ||*/ creature->GetMotionMaster()->GetCurrentMovementGeneratorType() != FOLLOW_MOTION_TYPE) { - handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName()); + handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str()); handler->SetSentErrorMessage(true); return false; } @@ -1102,7 +1102,7 @@ public: if (mgen->GetTarget() != player) { - handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName()); + handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str()); handler->SetSentErrorMessage(true); return false; } @@ -1110,12 +1110,12 @@ public: // reset movement creature->GetMotionMaster()->MovementExpired(true); - handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName()); + handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName().c_str()); return true; } // make npc whisper to player - static bool HandleNpcWhisperCommand(ChatHandler* handler, const char* args) + static bool HandleNpcWhisperCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1142,7 +1142,7 @@ public: return true; } - static bool HandleNpcYellCommand(ChatHandler* handler, const char* args) + static bool HandleNpcYellCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1164,7 +1164,7 @@ public: } // add creature, temp only - static bool HandleNpcAddTempSpawnCommand(ChatHandler* handler, const char* args) + static bool HandleNpcAddTempSpawnCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1184,7 +1184,7 @@ public: } //npc tame handling - static bool HandleNpcTameCommand(ChatHandler* handler, const char* /*args*/) + static bool HandleNpcTameCommand(ChatHandler* handler, char const* /*args*/) { Creature* creatureTarget = handler->getSelectedCreature(); if (!creatureTarget || creatureTarget->isPet()) @@ -1250,7 +1250,7 @@ public: return true; } - static bool HandleNpcAddFormationCommand(ChatHandler* handler, const char* args) + static bool HandleNpcAddFormationCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1302,7 +1302,7 @@ public: return true; } - static bool HandleNpcSetLinkCommand(ChatHandler* handler, const char* args) + static bool HandleNpcSetLinkCommand(ChatHandler* handler, char const* args) { if (!*args) return false; @@ -1337,7 +1337,7 @@ public: } //TODO: NpcCommands that need to be fixed : - static bool HandleNpcAddWeaponCommand(ChatHandler* /*handler*/, const char* /*args*/) + static bool HandleNpcAddWeaponCommand(ChatHandler* /*handler*/, char const* /*args*/) { /*if (!*args) return false; @@ -1405,7 +1405,7 @@ public: return true; } - static bool HandleNpcSetNameCommand(ChatHandler* /*handler*/, const char* /*args*/) + static bool HandleNpcSetNameCommand(ChatHandler* /*handler*/, char const* /*args*/) { /* Temp. disabled if (!*args) @@ -1452,7 +1452,7 @@ public: return true; } - static bool HandleNpcSetSubNameCommand(ChatHandler* /*handler*/, const char* /*args*/) + static bool HandleNpcSetSubNameCommand(ChatHandler* /*handler*/, char const* /*args*/) { /* Temp. disabled diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index baaa5d2bd43..c99931a90fb 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -156,7 +156,7 @@ public: sTicketMgr->CloseTicket(ticket->GetId(), player ? player->GetGUID() : -1); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName() : "Console", NULL, NULL, NULL); + std::string msg = ticket->FormatMessageString(*handler, player ? player->GetName().c_str() : "Console", NULL, NULL, NULL); handler->SendGlobalGMSysMessage(msg.c_str()); // Inform player, who submitted this ticket, that it is closed @@ -206,7 +206,7 @@ public: sTicketMgr->UpdateLastChange(); std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), NULL, NULL); - msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName() : "Console", comment); + msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment); handler->SendGlobalGMSysMessage(msg.c_str()); return true; @@ -258,7 +258,7 @@ public: return true; } - std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console"); + std::string msg = ticket->FormatMessageString(*handler, NULL, NULL, NULL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console"); handler->SendGlobalGMSysMessage(msg.c_str()); sTicketMgr->RemoveTicket(ticket->GetId()); @@ -389,7 +389,7 @@ public: sTicketMgr->UpdateLastChange(); std::string msg = ticket->FormatMessageString(*handler, NULL, ticket->GetAssignedToName().c_str(), - handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName() : "Console", NULL); + handler->GetSession() ? handler->GetSession()->GetPlayer()->GetName().c_str() : "Console", NULL); handler->SendGlobalGMSysMessage(msg.c_str()); return true; @@ -427,7 +427,7 @@ public: // Detect target's GUID uint64 guid = 0; - if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str())) + if (Player* player = sObjectAccessor->FindPlayerByName(name)) guid = player->GetGUID(); else guid = sObjectMgr->GetPlayerGUIDByName(name); diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp index f35f6baca98..e1b30d122de 100644 --- a/src/server/scripts/Commands/cs_titles.cpp +++ b/src/server/scripts/Commands/cs_titles.cpp @@ -36,7 +36,7 @@ public: static ChatCommand titlesSetCommandTable[] = { { "mask", SEC_GAMEMASTER, false, &HandleTitlesSetMaskCommand, "", NULL }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand titlesCommandTable[] = { @@ -44,17 +44,17 @@ public: { "current", SEC_GAMEMASTER, false, &HandleTitlesCurrentCommand, "", NULL }, { "remove", SEC_GAMEMASTER, false, &HandleTitlesRemoveCommand, "", NULL }, { "set", SEC_GAMEMASTER, false, NULL, "", titlesSetCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; static ChatCommand commandTable[] = { { "titles", SEC_GAMEMASTER, false, NULL, "", titlesCommandTable }, - { NULL, 0, false, NULL, "", NULL } + { NULL, SEC_PLAYER, false, NULL, "", NULL } }; return commandTable; } - static bool HandleTitlesCurrentCommand(ChatHandler* handler, const char* args) + static bool HandleTitlesCurrentCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r char* id_p = handler->extractKeyFromLink((char*)args, "Htitle"); @@ -99,7 +99,7 @@ public: return true; } - static bool HandleTitlesAddCommand(ChatHandler* handler, const char* args) + static bool HandleTitlesAddCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r char* id_p = handler->extractKeyFromLink((char*)args, "Htitle"); @@ -136,9 +136,8 @@ public: std::string tNameLink = handler->GetNameLink(target); - char const* targetName = target->GetName(); char titleNameStr[80]; - snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], targetName); + snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str()); target->SetTitle(titleInfo); handler->PSendSysMessage(LANG_TITLE_ADD_RES, id, titleNameStr, tNameLink.c_str()); @@ -146,7 +145,7 @@ public: return true; } - static bool HandleTitlesRemoveCommand(ChatHandler* handler, const char* args) + static bool HandleTitlesRemoveCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Htitle:title_id|h[name]|h|r char* id_p = handler->extractKeyFromLink((char*)args, "Htitle"); @@ -185,9 +184,8 @@ public: std::string tNameLink = handler->GetNameLink(target); - char const* targetName = target->GetName(); char titleNameStr[80]; - snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], targetName); + snprintf(titleNameStr, 80, titleInfo->name[handler->GetSessionDbcLocale()], target->GetName().c_str()); handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, id, titleNameStr, tNameLink.c_str()); @@ -201,7 +199,7 @@ public: } //Edit Player KnownTitles - static bool HandleTitlesSetMaskCommand(ChatHandler* handler, const char* args) + static bool HandleTitlesSetMaskCommand(ChatHandler* handler, char const* args) { if (!*args) return false; diff --git a/src/server/scripts/Examples/example_gossip_codebox.cpp b/src/server/scripts/Examples/example_gossip_codebox.cpp index a5627c68ff6..d6936c8fb9e 100644 --- a/src/server/scripts/Examples/example_gossip_codebox.cpp +++ b/src/server/scripts/Examples/example_gossip_codebox.cpp @@ -72,7 +72,7 @@ class example_gossip_codebox : public CreatureScript return true; } - bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, const char* code) + bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code) { player->PlayerTalkClass->ClearMenus(); if (sender == GOSSIP_SENDER_MAIN) @@ -80,7 +80,7 @@ class example_gossip_codebox : public CreatureScript switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - if (std::strcmp(code, player->GetName()) != 0) + if (player->GetName() != code) { DoScriptText(SAY_WRONG, creature); creature->CastSpell(player, SPELL_POLYMORPH, true); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 2a94ddb3134..2e911406979 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -693,7 +693,7 @@ void OutdoorPvPEP::BuffTeams() { for (PlayerSet::iterator itr = m_players[0].begin(); itr != m_players[0].end(); ++itr) { - Player* player = *itr; + if (Player* player = ObjectAccessor::FindPlayer(*itr)) { for (int i = 0; i < 4; ++i) player->RemoveAurasDueToSpell(EP_AllianceBuffs[i]); @@ -703,7 +703,7 @@ void OutdoorPvPEP::BuffTeams() } for (PlayerSet::iterator itr = m_players[1].begin(); itr != m_players[1].end(); ++itr) { - Player* player = *itr; + if (Player* player = ObjectAccessor::FindPlayer(*itr)) { for (int i = 0; i < 4; ++i) player->RemoveAurasDueToSpell(EP_HordeBuffs[i]); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index 9572125a4bd..fdf6533a64b 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -296,9 +296,12 @@ void OPvPCapturePointTF::ChangeState() uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled(); if (alliance_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); + sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); + for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) - (*itr)->AreaExploredOrEventHappens(TF_ALLY_QUEST); + if (Player* player = ObjectAccessor::FindPlayer(*itr)) + player->AreaExploredOrEventHappens(TF_ALLY_QUEST); break; } case OBJECTIVESTATE_HORDE: @@ -308,9 +311,12 @@ void OPvPCapturePointTF::ChangeState() uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled(); if (horde_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers); + sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); + for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) - (*itr)->AreaExploredOrEventHappens(TF_HORDE_QUEST); + if (Player* player = ObjectAccessor::FindPlayer(*itr)) + player->AreaExploredOrEventHappens(TF_HORDE_QUEST); break; } case OBJECTIVESTATE_NEUTRAL: diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index ab6d0e95c1d..68cc50a3022 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -350,7 +350,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); if (!spellInfo) { - sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]); + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); continue; } diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index fb540c177bc..236436b229b 100755 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -32,25 +32,25 @@ public: case CHAT_MSG_ADDON: if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends: %s", - player->GetName(), msg.c_str()); + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_SAY: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SAY] Player %s says (language %u): %s", - player->GetName(), lang, msg.c_str()); + player->GetName().c_str(), lang, msg.c_str()); break; case CHAT_MSG_EMOTE: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[TEXTEMOTE] Player %s emotes: %s", - player->GetName(), msg.c_str()); + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_YELL: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[YELL] Player %s yells (language %u): %s", - player->GetName(), lang, msg.c_str()); + player->GetName().c_str(), lang, msg.c_str()); break; } } @@ -59,10 +59,10 @@ public: { if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_WHISPER)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[WHISPER] Player %s tells %s: %s", - player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells %s: %s", - player->GetName(), receiver ? receiver->GetName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str()); } void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) @@ -74,52 +74,52 @@ public: case CHAT_MSG_PARTY: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Player %s tells group with leader %s: %s", - player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells group with leader %s: %s", - player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_PARTY_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[PARTY] Leader %s tells group: %s", - player->GetName(), msg.c_str()); + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Player %s tells raid with leader %s: %s", - player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells raid with leader %s: %s", - player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_RAID_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s tells raid: %s", - player->GetName(), msg.c_str()); + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID_WARNING: if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[RAID] Leader player %s warns raid with: %s", - player->GetName(), msg.c_str()); + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_BATTLEGROUND: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Player %s tells battleground with leader %s: %s", - player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s tells battleground with leader %s: %s", - player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); + player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str()); break; case CHAT_MSG_BATTLEGROUND_LEADER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[BATTLEGROUND] Leader player %s tells battleground: %s", - player->GetName(), msg.c_str()); + player->GetName().c_str(), msg.c_str()); break; } } @@ -131,16 +131,16 @@ public: case CHAT_MSG_GUILD: if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[GUILD] Player %s tells guild %s: %s", - player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); + player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[ADDON] Player %s sends to guild %s: %s", - player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); + player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); break; case CHAT_MSG_OFFICER: if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[OFFICER] Player %s tells guild %s officers: %s", - player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); + player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str()); break; } } @@ -155,10 +155,10 @@ public: if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[SYSCHAN] Player %s tells channel %s: %s", - player->GetName(), channel->GetName().c_str(), msg.c_str()); + player->GetName().c_str(), channel->GetName().c_str(), msg.c_str()); else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL)) sLog->outDebug(LOG_FILTER_PLAYER_CHATLOG, "[CHANNEL] Player %s tells channel %s: %s", - player->GetName(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str()); + player->GetName().c_str(), channel ? channel->GetName().c_str() : "<unknown>", msg.c_str()); } }; |