diff options
Diffstat (limited to 'src')
151 files changed, 1805 insertions, 1431 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 011210dd95b..90d112a1433 100755 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -86,7 +86,7 @@ extern int main(int argc, char **argv) { if (++c >= argc) { - printf("Runtime-Error: -c option requires an input argument"); + printf("Runtime-Error: -c option requires an input argument\n"); usage(argv[0]); return 1; } @@ -98,8 +98,8 @@ extern int main(int argc, char **argv) if (!ConfigMgr::Load(cfg_file)) { - printf("Invalid or missing configuration file : %s", cfg_file); - printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!"); + printf("Invalid or missing configuration file : %s\n", cfg_file); + printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n"); return 1; } 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/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index b666add74b3..2b67acfd6d0 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -176,7 +176,7 @@ AccountOpResult ChangePassword(uint32 accountId, std::string newPassword) return AOR_OK; } -uint32 GetId(std::string username) +uint32 GetId(std::string const& username) { PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME); stmt->setString(0, username); @@ -265,7 +265,7 @@ bool normalizeString(std::string& utf8String) return WStrToUtf8(buffer, maxLength, utf8String); } -std::string CalculateShaPassHash(std::string& name, std::string& password) +std::string CalculateShaPassHash(std::string const& name, std::string const& password) { SHA1Hash sha; sha.Initialize(); diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index aaaf4f4f603..c14bcc48bdc 100755 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -42,12 +42,12 @@ namespace AccountMgr AccountOpResult ChangePassword(uint32 accountId, std::string newPassword); bool CheckPassword(uint32 accountId, std::string password); - uint32 GetId(std::string username); + uint32 GetId(std::string const& username); uint32 GetSecurity(uint32 accountId); uint32 GetSecurity(uint32 accountId, int32 realmId); bool GetName(uint32 accountId, std::string& name); uint32 GetCharactersCount(uint32 accountId); - std::string CalculateShaPassHash(std::string& name, std::string& password); + std::string CalculateShaPassHash(std::string const& name, std::string const& password); bool normalizeString(std::string& utf8String); bool IsPlayerAccount(uint32 gmlevel); 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/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 1c99934bafc..b3f5c7bf704 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -440,7 +440,7 @@ void Battlefield::BroadcastPacketToWar(WorldPacket& data) const player->GetSession()->SendPacket(&data); } -WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg) +WorldPacket Battlefield::BuildWarningAnnPacket(std::string const& msg) { WorldPacket data(SMSG_MESSAGECHAT, 200); diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 2ca6a2e3f96..0752fa88fc1 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -314,7 +314,7 @@ class Battlefield : public ZoneScript /// Called when a player enter in battlefield zone virtual void OnPlayerEnterZone(Player* /*player*/) {}; - WorldPacket BuildWarningAnnPacket(std::string msg); + WorldPacket BuildWarningAnnPacket(std::string const& msg); void SendWarningToAllInZone(uint32 entry); //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED void SendWarningToPlayer(Player* player, uint32 entry); diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index e88c501398e..d763b29bbc1 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -36,10 +36,9 @@ ArenaTeam::ArenaTeam() } ArenaTeam::~ArenaTeam() -{ -} +{ } -bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) +bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) { // Check if captain is present if (!ObjectAccessor::FindPlayer(captainGuid)) @@ -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 @@ -481,7 +479,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet) player->GetSession()->SendPacket(packet); } -void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3) +void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3) { WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1); data << uint8(event); diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index d8ad2c09e59..7d2d680cddc 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.h @@ -119,7 +119,7 @@ class ArenaTeam ArenaTeam(); ~ArenaTeam(); - bool Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor); + bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor); void Disband(WorldSession* session); typedef std::list<ArenaTeamMember> MemberList; @@ -129,7 +129,7 @@ class ArenaTeam uint8 GetSlot() const { return GetSlotByType(GetType()); } static uint8 GetSlotByType(uint32 type); uint64 GetCaptain() const { return CaptainGuid; } - std::string GetName() const { return TeamName; } + std::string const& GetName() const { return TeamName; } const ArenaTeamStats& GetStats() const { return Stats; } uint32 GetRating() const { return Stats.Rating; } @@ -149,7 +149,7 @@ class ArenaTeam bool IsMember(uint64 guid) const; ArenaTeamMember* GetMember(uint64 guid); - ArenaTeamMember* GetMember(const std::string& name); + ArenaTeamMember* GetMember(std::string const& name); bool IsFighting() const; @@ -159,7 +159,7 @@ class ArenaTeam void SaveToDB(); void BroadcastPacket(WorldPacket* packet); - void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3); + void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3); void NotifyStatsChanged(); void Roster(WorldSession* session); 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/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 35304bc9190..7dba811c1a1 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -86,13 +86,13 @@ bool BattlegroundSA::ResetObjs() for (uint8 i = 0; i < 6; i++) GateStatus[i] = BG_SA_GATE_OK; - for (uint8 i = 0; i < BG_SA_BOAT_ONE; i++) + for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++) { if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY)) return false; } - for (uint8 i = BG_SA_BOAT_ONE; i < BG_SA_SIGIL_1; i++) + for (uint8 i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++) { uint32 boatid = 0; switch (i) @@ -113,7 +113,7 @@ bool BattlegroundSA::ResetObjs() return false; } - for (uint8 i = BG_SA_SIGIL_1; i < BG_SA_CENTRAL_FLAG; i++) + for (uint8 i = BG_SA_SIGIL_1; i <= BG_SA_LEFT_FLAGPOLE; i++) { if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], @@ -141,7 +141,7 @@ bool BattlegroundSA::ResetObjs() OverrideGunFaction(); DemolisherStartState(true); - for (uint8 i = 0; i <= BG_SA_TITAN_RELIC; i++) + for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++) { SpawnBGObject(i, RESPAWN_IMMEDIATELY); GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF); @@ -182,7 +182,7 @@ bool BattlegroundSA::ResetObjs() } //GY capture points - for (uint8 i = BG_SA_CENTRAL_FLAG; i < BG_SA_PORTAL_DEFFENDER_BLUE; i++) + for (uint8 i = BG_SA_CENTRAL_FLAG; i <= BG_SA_LEFT_FLAG; i++) { AddObject(i, (BG_SA_ObjEntries[i] - (Attackers == TEAM_ALLIANCE ? 1 : 0)), BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], @@ -191,15 +191,6 @@ bool BattlegroundSA::ResetObjs() GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF); } - for (uint8 i = BG_SA_PORTAL_DEFFENDER_BLUE; i < BG_SA_BOMB; i++) - { - AddObject(i, BG_SA_ObjEntries[i], - BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], - BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3], - 0, 0, 0, 0, RESPAWN_ONE_DAY); - GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF); - } - for (uint8 i = BG_SA_BOMB; i < BG_SA_MAXOBJ; i++) { AddObject(i, BG_SA_ObjEntries[BG_SA_BOMB], @@ -657,7 +648,7 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go) } if (i < 5) - DelObject(i+9); + DelObject(i + 14); UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1); if (rewardHonor) UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1)); @@ -973,4 +964,3 @@ void BattlegroundSA::SendTransportsRemove(Player* player) player->GetSession()->SendPacket(&packet); } } - diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 6de3731da50..9089f0c2818 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -228,6 +228,11 @@ enum BG_SA_Objects BG_SA_PURPLE_GATE, BG_SA_ANCIENT_GATE, BG_SA_TITAN_RELIC, + BG_SA_PORTAL_DEFFENDER_BLUE, + BG_SA_PORTAL_DEFFENDER_GREEN, + BG_SA_PORTAL_DEFFENDER_YELLOW, + BG_SA_PORTAL_DEFFENDER_PURPLE, + BG_SA_PORTAL_DEFFENDER_RED, BG_SA_BOAT_ONE, BG_SA_BOAT_TWO, BG_SA_SIGIL_1, @@ -241,11 +246,6 @@ enum BG_SA_Objects BG_SA_CENTRAL_FLAG, BG_SA_RIGHT_FLAG, BG_SA_LEFT_FLAG, - BG_SA_PORTAL_DEFFENDER_BLUE, - BG_SA_PORTAL_DEFFENDER_GREEN, - BG_SA_PORTAL_DEFFENDER_YELLOW, - BG_SA_PORTAL_DEFFENDER_PURPLE, - BG_SA_PORTAL_DEFFENDER_RED, BG_SA_BOMB, BG_SA_MAXOBJ = BG_SA_BOMB+68 }; @@ -259,6 +259,12 @@ float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = { 1214.681f, 81.21f, 53.413f, 5.745f }, { 878.555f, -108.2f, 117.845f, 0.0f }, { 836.5f, -108.8f, 120.219f, 0.0f }, + // Portal + {1468.380005f, -225.798996f, 30.896200f, 0.0f}, //blue + {1394.270020f, 72.551399f, 31.054300f, 0.0f}, //green + {1065.260010f, -89.79501f, 81.073402f, 0.0f}, //yellow + {1216.069946f, 47.904301f, 54.278198f, 0.0f}, //purple + {1255.569946f, -233.548996f, 56.43699f, 0.0f}, //red // Ships { 2679.696777f, -826.891235f, 3.712860f, 5.78367f}, //rot2 1 rot3 0.0002f { 2574.003662f, 981.261475f, 2.603424f, 0.807696f}, @@ -276,12 +282,6 @@ float const BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] = { 1215.108032f, -65.715767f, 70.084267f, -3.124123f}, { 1338.859253f, -153.327316f, 30.895077f, -2.530723f}, { 1309.192017f, 9.416233f, 30.893402f, 1.518436f}, - // Portal - {1468.380005f, -225.798996f, 30.896200f, 0.0f}, //blue - {1394.270020f, 72.551399f, 31.054300f, 0.0f}, //green - {1065.260010f, -89.79501f, 81.073402f, 0.0f}, //yellow - {1216.069946f, 47.904301f, 54.278198f, 0.0f}, //purple - {1255.569946f, -233.548996f, 56.43699f, 0.0f}, //red // Bombs {1333.45f, 211.354f, 31.0538f, 5.03666f}, {1334.29f, 209.582f, 31.0532f, 1.28088f}, @@ -375,6 +375,11 @@ uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = 190723, 192549, 192834, + 192819, + 192819, + 192819, + 192819, + 192819, 0, // Boat 0, // Boat 192687, @@ -388,11 +393,6 @@ uint32 const BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] = 191310, 191306, 191308, - 192819, - 192819, - 192819, - 192819, - 192819, 190753 }; diff --git a/src/server/game/Calendar/Calendar.h b/src/server/game/Calendar/Calendar.h index a2d2dc2ffb7..273db4c3854 100755 --- a/src/server/game/Calendar/Calendar.h +++ b/src/server/game/Calendar/Calendar.h @@ -46,8 +46,8 @@ class CalendarInvite void SetStatusTime(uint32 statusTime) { _statusTime = statusTime; } uint32 GetStatusTime() const { return _statusTime; } - void SetText(std::string text) { _text = text; } - std::string GetText() const { return _text; } + void SetText(std::string const& text) { _text = text; } + std::string const& GetText() const { return _text; } void SetStatus(CalendarInviteStatus status) { _status = status; } CalendarInviteStatus GetStatus() const { return _status; } @@ -89,11 +89,11 @@ class CalendarEvent void SetGuildId(uint32 guildId) { _guildId = guildId; } uint32 GetGuildId() const { return _guildId; } - void SetTitle(std::string title) { _title = title; } - std::string GetTitle() const { return _title; } + void SetTitle(std::string const& title) { _title = title; } + std::string const& GetTitle() const { return _title; } - void SetDescription(std::string description) { _description = description; } - std::string GetDescription() const { return _description; } + void SetDescription(std::string const& description) { _description = description; } + std::string const& GetDescription() const { return _description; } void SetType(CalendarEventType type) { _type = type; } CalendarEventType GetType() const { return _type; } 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..bdb5112c7ef 100755 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -172,7 +172,7 @@ class Channel void MakeNotModerator(WorldPacket* data); //? 0x06 void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07 void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08 - void MakePlayerNotFound(WorldPacket* data, const std::string& name); //+ 0x09 + void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09 void MakeNotOwner(WorldPacket* data); //? 0x0A void MakeChannelOwner(WorldPacket* data); //? 0x0B void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C @@ -183,15 +183,15 @@ class Channel void MakeBanned(WorldPacket* data); //? 0x13 void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14 void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15 - void MakePlayerNotBanned(WorldPacket* data, const std::string& name); //? 0x16 + void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16 void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17 void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18 void MakeInviteWrongFaction(WorldPacket* data); //? 0x19 void MakeWrongFaction(WorldPacket* data); //? 0x1A void MakeInvalidName(WorldPacket* data); //? 0x1B void MakeNotModerated(WorldPacket* data); //? 0x1C - void MakePlayerInvited(WorldPacket* data, const std::string& name); //+ 0x1D - void MakePlayerInviteBanned(WorldPacket* data, const std::string &name);//? 0x1E + void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D + void MakePlayerInviteBanned(WorldPacket* data, std::string const& name);//? 0x1E void MakeThrottled(WorldPacket* data); //? 0x1F void MakeNotInArea(WorldPacket* data); //? 0x20 void MakeNotInLfg(WorldPacket* data); //? 0x21 @@ -245,14 +245,14 @@ class Channel public: uint32 m_Team; - Channel(const std::string& name, uint32 channel_id, uint32 Team = 0); - std::string GetName() const { return m_name; } + Channel(std::string const& name, uint32 channel_id, uint32 Team = 0); + 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; } bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; } - std::string GetPassword() const { return m_password; } - void SetPassword(const std::string& npassword) { m_password = npassword; } + std::string const& GetPassword() const { return m_password; } + void SetPassword(std::string const& npassword) { m_password = npassword; } void SetAnnounce(bool nannounce) { m_announce = nannounce; } uint32 GetNumPlayers() const { return players.size(); } uint8 GetFlags() const { return m_flags; } 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/Chat/Chat.h b/src/server/game/Chat/Chat.h index d4701b10ce1..d07f036f780 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -128,7 +128,7 @@ class ChatHandler protected: explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand); - bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd); + bool ExecuteCommandInTable(ChatCommand* table, const char* text, std::string const& fullcmd); bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd); private: diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 7dc4b57d188..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; @@ -737,7 +737,7 @@ void ConditionMgr::LoadConditions(bool isReload) Condition* cond = new Condition(); int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); cond->SourceGroup = fields[1].GetUInt32(); - cond->SourceEntry = fields[2].GetUInt32(); + cond->SourceEntry = fields[2].GetInt32(); cond->SourceId = fields[3].GetInt32(); cond->ElseGroup = fields[4].GetUInt32(); int32 iConditionTypeOrReference = fields[5].GetInt32(); 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/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 16595eb16dd..850c58bdf93 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -118,7 +118,7 @@ DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore(ItemRandomProp DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore(ItemRandomSuffixfmt); DBCStorage <ItemSetEntry> sItemSetStore(ItemSetEntryfmt); -DBCStorage <LFGDungeonEntryDbc> sLFGDungeonStore(LFGDungeonEntryfmt); +DBCStorage <LFGDungeonEntry> sLFGDungeonStore(LFGDungeonEntryfmt); DBCStorage <LiquidTypeEntry> sLiquidTypeStore(LiquidTypefmt); DBCStorage <LockEntry> sLockStore(LockEntryfmt); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index f6fabb5a73d..cd30ed587f8 100755 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -120,7 +120,7 @@ extern DBCStorage <ItemLimitCategoryEntry> sItemLimitCategoryStore; extern DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore; extern DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore; extern DBCStorage <ItemSetEntry> sItemSetStore; -extern DBCStorage <LFGDungeonEntryDbc> sLFGDungeonStore; +extern DBCStorage <LFGDungeonEntry> sLFGDungeonStore; extern DBCStorage <LiquidTypeEntry> sLiquidTypeStore; extern DBCStorage <LockEntry> sLockStore; extern DBCStorage <MailTemplateEntry> sMailTemplateStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 2fc61e69fe2..20eab098add 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1193,7 +1193,7 @@ struct ItemSetEntry uint32 required_skill_value; // 52 m_requiredSkillRank }; -struct LFGDungeonEntryDbc +struct LFGDungeonEntry { uint32 ID; // 0 char* name[16]; // 1-17 Name lang diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 16fda8952ac..2001ddd07b2 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -32,16 +32,16 @@ #include "GameEventMgr.h" LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1), - m_options(sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE)), - m_lfgPlayerScript(new LFGPlayerScript()), m_lfgGroupScript(new LFGGroupScript()) -{ } + m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)) +{ + new LFGPlayerScript(); + new LFGGroupScript(); +} LFGMgr::~LFGMgr() { for (LfgRewardMap::iterator itr = m_RewardMap.begin(); itr != m_RewardMap.end(); ++itr) delete itr->second; - delete m_lfgPlayerScript; - delete m_lfgGroupScript; } void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) @@ -239,7 +239,7 @@ void LFGMgr::LoadRewards() sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } -LFGDungeonEntry const* LFGMgr::GetLFGDungeon(uint32 id) +LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id) { LFGDungeonMap::const_iterator itr = m_LfgDungeonMap.find(id); if (itr != m_LfgDungeonMap.end()) @@ -262,7 +262,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) // Initialize Dungeon map with data from dbcs for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { - LFGDungeonEntryDbc const* dungeon = sLFGDungeonStore.LookupEntry(i); + LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i); if (!dungeon) continue; @@ -272,7 +272,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) case LFG_TYPE_HEROIC: case LFG_TYPE_RAID: case LFG_TYPE_RANDOM: - m_LfgDungeonMap[dungeon->ID] = LFGDungeonEntry(dungeon); + m_LfgDungeonMap[dungeon->ID] = LFGDungeonData(dungeon); break; } } @@ -299,7 +299,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) continue; } - LFGDungeonEntry& data = dungeonItr->second; + LFGDungeonData& data = dungeonItr->second; data.x = fields[1].GetFloat(); data.y = fields[2].GetFloat(); data.z = fields[3].GetFloat(); @@ -314,9 +314,10 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) // Fill all other teleport coords from areatriggers for (LFGDungeonMap::iterator itr = m_LfgDungeonMap.begin(); itr != m_LfgDungeonMap.end(); ++itr) { - LFGDungeonEntry& dungeon = itr->second; + LFGDungeonData& dungeon = itr->second; + // No teleport coords in database, load from areatriggers - if (dungeon.x == 0.0f && dungeon.y == 0.0f && dungeon.z == 0.0f) + if (dungeon.type != LFG_TYPE_RANDOM && dungeon.x == 0.0f && dungeon.y == 0.0f && dungeon.z == 0.0f) { AreaTrigger const* at = sObjectMgr->GetMapEntranceTrigger(dungeon.map); if (!at) @@ -349,7 +350,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) void LFGMgr::Update(uint32 diff) { - if (!m_options) + if (!isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) return; time_t currTime = time(NULL); @@ -395,7 +396,9 @@ void LFGMgr::Update(uint32 diff) uint64 pguid = itVotes->first; if (pguid != boot.victim) SendLfgBootProposalUpdate(pguid, boot); + SetState(pguid, LFG_STATE_DUNGEON); } + SetState(itBoot->first, LFG_STATE_DUNGEON); m_Boots.erase(itBoot); } } @@ -462,7 +465,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */) for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it) { - LFGDungeonEntry const* dungeon = GetLFGDungeon(*it); + LFGDungeonData const* dungeon = GetLFGDungeon(*it); if (!dungeon) // should never happen - We provide a list from sLFGDungeonStore continue; @@ -490,10 +493,10 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */) else if (ar->item) { - if (!player->HasItemCount(ar->item, 1) && (!ar->item2 || !player->HasItemCount(ar->item2, 1))) + if (!player->HasItemCount(ar->item) && (!ar->item2 || !player->HasItemCount(ar->item2))) lockData = LFG_LOCKSTATUS_MISSING_ITEM; } - else if (ar->item2 && !player->HasItemCount(ar->item2, 1)) + else if (ar->item2 && !player->HasItemCount(ar->item2)) lockData = LFG_LOCKSTATUS_MISSING_ITEM; } @@ -883,11 +886,13 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /* SetState(gguid, LFG_STATE_QUEUED); LfgQueue& queue = GetQueue(gguid); queue.AddQueueData(gguid, time_t(time(NULL)), roleCheck.dungeons, roleCheck.roles); + m_RoleChecks.erase(itRoleCheck); } else if (roleCheck.state != LFG_ROLECHECK_INITIALITING) + { RestoreState(gguid, "Rolecheck Failed"); - - m_RoleChecks.erase(itRoleCheck); + m_RoleChecks.erase(itRoleCheck); + } } /** @@ -1014,7 +1019,7 @@ void LFGMgr::MakeNewGroup(const LfgProposal& proposal) } // Set the dungeon difficulty - LFGDungeonEntry const* dungeon = GetLFGDungeon(proposal.dungeonId); + LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId); ASSERT(dungeon); Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL; @@ -1380,26 +1385,36 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept) */ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*/) { - sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::TeleportPlayer: [" UI64FMTD "] is being teleported %s", player->GetGUID(), out ? "out" : "in"); + LFGDungeonData const* dungeon = NULL; + Group* group = player->GetGroup(); - Group* grp = player->GetGroup(); - uint64 gguid = grp->GetGUID(); - LFGDungeonEntry const* dungeon = GetLFGDungeon(GetDungeon(gguid)); - if (!dungeon || (out && player->GetMapId() != uint32(dungeon->map))) + if (group && group->isLFGGroup()) + dungeon = GetLFGDungeon(GetDungeon(group->GetGUID())); + + if (!dungeon) + { + sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s not in group/lfggroup or dungeon not found!", + player->GetName().c_str()); + player->GetSession()->SendLfgTeleportError(uint8(LFG_TELEPORTERROR_INVALID_LOCATION)); return; + } if (out) { - player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); - player->TeleportToBGEntryPoint(); + sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported out. Current Map %u - Expected Map %u", + player->GetName().c_str(), player->GetMapId(), uint32(dungeon->map)); + if (player->GetMapId() == uint32(dungeon->map)) + { + player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW); + player->TeleportToBGEntryPoint(); + } + return; } LfgTeleportError error = LFG_TELEPORTERROR_OK; - if (!grp || !grp->isLFGGroup()) // should never happen, but just in case... - error = LFG_TELEPORTERROR_INVALID_LOCATION; - else if (!player->isAlive()) + if (!player->isAlive()) error = LFG_TELEPORTERROR_PLAYER_DEAD; else if (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING)) error = LFG_TELEPORTERROR_FALLING; @@ -1409,57 +1424,56 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* error = LFG_TELEPORTERROR_IN_VEHICLE; else if (player->GetCharmGUID()) error = LFG_TELEPORTERROR_CHARMING; - else + else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance { - if (!dungeon) - error = LFG_TELEPORTERROR_INVALID_LOCATION; - else if (player->GetMapId() != uint32(dungeon->map)) // Do not teleport players in dungeon to the entrance - { - uint32 mapid = dungeon->map; - float x = dungeon->x; - float y = dungeon->y; - float z = dungeon->z; - float orientation = dungeon->o; + uint32 mapid = dungeon->map; + float x = dungeon->x; + float y = dungeon->y; + float z = dungeon->z; + float orientation = dungeon->o; - if (!fromOpcode) + if (!fromOpcode) + { + // Select a player inside to be teleported to + for (GroupReference* itr = group->GetFirstMember(); itr != NULL && !mapid; itr = itr->next()) { - // Select a player inside to be teleported to - for (GroupReference* itr = grp->GetFirstMember(); itr != NULL && !mapid; itr = itr->next()) + Player* plrg = itr->getSource(); + if (plrg && plrg != player && plrg->GetMapId() == uint32(dungeon->map)) { - Player* plrg = itr->getSource(); - if (plrg && plrg != player && plrg->GetMapId() == uint32(dungeon->map)) - { - mapid = plrg->GetMapId(); - x = plrg->GetPositionX(); - y = plrg->GetPositionY(); - z = plrg->GetPositionZ(); - orientation = plrg->GetOrientation(); - } + mapid = plrg->GetMapId(); + x = plrg->GetPositionX(); + y = plrg->GetPositionY(); + z = plrg->GetPositionZ(); + orientation = plrg->GetOrientation(); + break; } } + } - if (error == LFG_TELEPORTERROR_OK) - { - if (!player->GetMap()->IsDungeon()) - player->SetBattlegroundEntryPoint(); + if (error == LFG_TELEPORTERROR_OK) + { + if (!player->GetMap()->IsDungeon()) + player->SetBattlegroundEntryPoint(); - if (player->isInFlight()) - { - player->GetMotionMaster()->MovementExpired(); - player->CleanupAfterTaxiFlight(); - } + if (player->isInFlight()) + { + player->GetMotionMaster()->MovementExpired(); + player->CleanupAfterTaxiFlight(); + } - if (!player->TeleportTo(mapid, x, y, z, orientation)) - { - error = LFG_TELEPORTERROR_INVALID_LOCATION; - sLog->outError(LOG_FILTER_LFG, "LfgMgr::TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u: ", player->GetGUID(), mapid); - } + if (!player->TeleportTo(mapid, x, y, z, orientation)) + { + error = LFG_TELEPORTERROR_INVALID_LOCATION; + sLog->outError(LOG_FILTER_LFG, "TeleportPlayer: Failed to teleport [" UI64FMTD "] to map %u (x: %f, y: %f, z: %f)", player->GetGUID(), mapid, x, y, z); } } } if (error != LFG_TELEPORTERROR_OK) player->GetSession()->SendLfgTeleportError(uint8(error)); + + sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported in. Result: %u", + player->GetName().c_str(), error); } /** @@ -1501,7 +1515,7 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player) SetState(guid, LFG_STATE_FINISHED_DUNGEON); // Give rewards only if its a random or seasonal dungeon - LFGDungeonEntry const* dungeon = GetLFGDungeon(rDungeonId); + LFGDungeonData const* dungeon = GetLFGDungeon(rDungeonId); if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal)) { sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RewardDungeonDoneFor: [" UI64FMTD "] dungeon %u is not random nor seasonal", guid, rDungeonId); @@ -1551,7 +1565,7 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player) */ const LfgDungeonSet& LFGMgr::GetDungeonsByRandom(uint32 randomdungeon) { - LFGDungeonEntry const* dungeon = GetLFGDungeon(randomdungeon); + LFGDungeonData const* dungeon = GetLFGDungeon(randomdungeon); uint32 group = dungeon ? dungeon->group : 0; return m_CachedDungeonMap[group]; } @@ -1586,7 +1600,7 @@ LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level) */ LfgType LFGMgr::GetDungeonType(uint32 dungeonId) { - LFGDungeonEntry const* dungeon = GetLFGDungeon(dungeonId); + LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId); if (!dungeon) return LFG_TYPE_NONE; @@ -1882,6 +1896,27 @@ bool LFGMgr::AllQueued(const LfgGuidList& check) return true; } +// Only for debugging purposes +void LFGMgr::Clean() +{ + m_Queues.clear(); +} + +bool LFGMgr::isOptionEnabled(uint32 option) +{ + return m_options & option; +} + +uint32 LFGMgr::GetOptions() +{ + return m_options; +} + +void LFGMgr::SetOptions(uint32 options) +{ + m_options = options; +} + bool LFGMgr::IsSeasonActive(uint32 dungeonId) { switch (dungeonId) @@ -1897,3 +1932,25 @@ bool LFGMgr::IsSeasonActive(uint32 dungeonId) } return false; } + +std::string LFGMgr::DumpQueueInfo(bool /*full*/) +{ + uint32 size = uint32(m_Queues.size()); + std::ostringstream o; + + o << "Number of Queues: " << size << "\n"; + for (LfgQueueMap::const_iterator itr = m_Queues.begin(); itr != m_Queues.end(); ++itr) + { + std::string const& queued = itr->second.DumpQueueInfo(); + std::string const& compatibles = itr->second.DumpCompatibleInfo(); + o << queued << compatibles; + /* + if (full) + { + LfgCompatibleMap const& compatibles = itr->second.GetCompatibleMap(); + } + */ + } + + return o.str(); +} diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 1f9c9cf3b2c..a7d2d826a09 100755 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -25,11 +25,15 @@ #include "LFGGroupData.h" #include "LFGPlayerData.h" -class LFGPlayerScript; -class LFGGroupScript; class Group; class Player; +enum LfgOptions +{ + LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01, + LFG_OPTION_ENABLE_RAID_BROWSER = 0x02, +}; + enum LFGMgrEnum { LFG_TIME_ROLECHECK = 40 * IN_MILLISECONDS, @@ -117,7 +121,7 @@ enum LfgRoleCheckState }; // Forward declaration (just to have all typedef together) -struct LFGDungeonEntry; +struct LFGDungeonData; struct LfgReward; struct LfgQueueInfo; struct LfgRoleCheck; @@ -136,7 +140,7 @@ typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerMap; typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootMap; typedef std::map<uint64, LfgGroupData> LfgGroupDataMap; typedef std::map<uint64, LfgPlayerData> LfgPlayerDataMap; -typedef UNORDERED_MAP<uint32, LFGDungeonEntry> LFGDungeonMap; +typedef UNORDERED_MAP<uint32, LFGDungeonData> LFGDungeonMap; // Data needed by SMSG_LFG_JOIN_RESULT struct LfgJoinResultData @@ -152,7 +156,7 @@ struct LfgJoinResultData struct LfgUpdateData { LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), comment("") {} - LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string _comment): + LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment): updateType(_type), dungeons(_dungeons), comment(_comment) {} LfgUpdateType updateType; @@ -251,12 +255,12 @@ struct LfgPlayerBoot std::string reason; ///< kick reason }; -struct LFGDungeonEntry +struct LFGDungeonData { - LFGDungeonEntry(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0), + LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0), maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f) { } - LFGDungeonEntry(LFGDungeonEntryDbc const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map), + LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map), type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype), minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)), seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f) @@ -348,26 +352,30 @@ class LFGMgr bool IsTeleported(uint64 guid); bool AllQueued(LfgGuidList const& check); + void Clean(); + static bool HasIgnore(uint64 guid1, uint64 guid2); static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data); + bool isOptionEnabled(uint32 option); + uint32 GetOptions(); + void SetOptions(uint32 options); bool IsSeasonActive(uint32 dungeonId); + std::string DumpQueueInfo(bool full = false); static std::string ConcatenateDungeons(LfgDungeonSet const& dungeons); static std::string GetRolesString(uint8 roles); static char const * GetStateString(LfgState state); void LoadLFGDungeons(bool reload = false); - LFGDungeonEntry const* GetLFGDungeon(uint32 id); + LFGDungeonData const* GetLFGDungeon(uint32 id); LFGDungeonMap& GetLFGDungeonMap(); - - void ClearState(uint64 guid, char const *debugMsg); private: uint8 GetTeam(uint64 guid); uint64 GetGroup(uint64 guid); void RestoreState(uint64 guid, char const *debugMsg); - + void ClearState(uint64 guid, char const *debugMsg); void SetDungeon(uint64 guid, uint32 dungeon); void SetLockedDungeons(uint64 guid, LfgLockMap const& lock); void DecreaseKicksLeft(uint64 guid); @@ -406,9 +414,6 @@ class LFGMgr LfgPlayerDataMap m_Players; ///< Player data LfgGroupDataMap m_Groups; ///< Group data LfgGuidList m_teleport; ///< Players being teleported - - LFGPlayerScript *m_lfgPlayerScript; - LFGGroupScript *m_lfgGroupScript; }; #define sLFGMgr ACE_Singleton<LFGMgr, ACE_Null_Mutex>::instance() diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index c1d89a16300..131a3e7a992 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -25,6 +25,7 @@ #include "Log.h" #include "ObjectMgr.h" #include "World.h" +#include "GroupMgr.h" /** Given a list of guids returns the concatenation using | as delimiter @@ -536,4 +537,45 @@ void LfgQueue::UpdateQueueTimers(time_t currTime) time_t LfgQueue::GetJoinTime(uint64 guid) { return m_QueueDataMap[guid].joinTime; -}
\ No newline at end of file +} + +LfgCompatibleMap const& LfgQueue::GetCompatibleMap() +{ + return m_CompatibleMap; +} + +std::string LfgQueue::DumpQueueInfo() const +{ + uint32 players = 0; + uint32 groups = 0; + uint32 playersInGroup = 0; + + for (uint8 i = 0; i < 2; ++i) + { + LfgGuidList const& queue = i ? m_newToQueue : m_currentQueue; + for (LfgGuidList::const_iterator it = queue.begin(); it != queue.end(); ++it) + { + uint64 guid = *it; + if (IS_GROUP(guid)) + { + groups++; + if (Group const* group = sGroupMgr->GetGroupByGUID(GUID_LOPART(guid))) + playersInGroup += group->GetMembersCount(); + else + playersInGroup += 2; // Shouldn't happen but just in case + } + else + players++; + } + } + std::ostringstream o; + o << "Queued Players: " << players << "(in group: " << playersInGroup << ") Groups: " << groups << "\n"; + return o.str(); +} + +std::string LfgQueue::DumpCompatibleInfo() const +{ + std::ostringstream o; + o << "Compatible Map size: " << m_CompatibleMap.size() << "\n"; + return o.str(); +} diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 10ce42da610..522ded70550 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -34,11 +34,17 @@ LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript") void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + sLFGMgr->InitializeLockedDungeons(player); } void LFGPlayerScript::OnLogout(Player* player) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + uint64 guid = player->GetGUID(); sLFGMgr->LeaveLfg(guid); LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE); @@ -51,6 +57,9 @@ void LFGPlayerScript::OnLogout(Player* player) void LFGPlayerScript::OnLogin(Player* player) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + sLFGMgr->InitializeLockedDungeons(player); sLFGMgr->SetTeam(player->GetGUID(), player->GetTeam()); // TODO - Restore LfgPlayerData and send proper status to player if it was in a group @@ -69,6 +78,9 @@ LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript") void LFGGroupScript::OnAddMember(Group* group, uint64 guid) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + uint64 gguid = group->GetGUID(); uint64 leader = group->GetLeaderGUID(); @@ -106,6 +118,9 @@ void LFGGroupScript::OnAddMember(Group* group, uint64 guid) void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + uint64 gguid = group->GetGUID(); sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : "")); @@ -157,6 +172,9 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth void LFGGroupScript::OnDisband(Group* group) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + uint64 gguid = group->GetGUID(); sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid); @@ -165,6 +183,9 @@ void LFGGroupScript::OnDisband(Group* group) void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + uint64 gguid = group->GetGUID(); sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); @@ -173,6 +194,9 @@ void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 o void LFGGroupScript::OnInviteMember(Group* group, uint64 guid) { + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER)) + return; + uint64 gguid = group->GetGUID(); uint64 leader = group->GetLeaderGUID(); sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader); 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..c0703196075 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 59f68a0494f..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: @@ -1115,6 +1114,19 @@ void GameObject::Use(Unit* user) player->SendPreparedGossip(this); return; } + case GAMEOBJECT_TYPE_TRAP: //6 + { + GameObjectTemplate const* goInfo = GetGOInfo(); + if (goInfo->trap.spellId) + CastSpell(user, goInfo->trap.spellId); + + m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)); // template or 4 seconds + + if (goInfo->trap.type == 1) // Deactivate after trigger + SetLootState(GO_JUST_DEACTIVATED); + + return; + } //Sitting: Wooden bench, chairs enzz case GAMEOBJECT_TYPE_CHAIR: //7 { @@ -1629,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; } @@ -1743,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(); @@ -1788,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(); @@ -1822,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()) @@ -1847,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); @@ -1871,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; } @@ -1904,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); @@ -1924,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..32d73579f51 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..0bb4214de32 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(); } - void SetName(const std::string& newname) { m_name=newname; } + std::string const& GetName() const { return m_name; } + void SetName(std::string const& 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 93a0580a866..973eba5da25 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -190,16 +190,14 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level SetTaximaskNode(213); //Shattered Sun Staging Area } -void PlayerTaxi::LoadTaxiMask(const char* data) +void PlayerTaxi::LoadTaxiMask(std::string const &data) { Tokenizer tokens(data, ' '); - uint8 index; - Tokenizer::const_iterator iter; - for (iter = tokens.begin(), index = 0; - (index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index) + uint8 index = 0; + for (Tokenizer::const_iterator iter = tokens.begin(); index < TaxiMaskSize && iter != tokens.end(); ++iter, ++index) { - // load and set bits only for existed taxi nodes + // load and set bits only for existing taxi nodes m_taximask[index] = sTaxiNodesMask[index] & uint32(atol(*iter)); } } @@ -1753,7 +1751,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 +1840,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 +2086,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 +2110,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 +2127,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 +2449,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 +2775,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 +5076,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 +5085,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 +5578,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 +5593,7 @@ void Player::UpdateLocalChannels(uint32 newZone) if (!current_zone) return; - ChannelMgr* cMgr = channelMgr(GetTeam()); + ChannelMgr* cMgr = ChannelMgr::forTeam(GetTeam()); if (!cMgr) return; @@ -5782,7 +5781,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 +6649,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 +6664,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 +6705,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 +6720,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 +7108,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 +7141,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 +7193,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 +7201,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 +7219,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 +7240,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 +7600,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 +8389,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 +11630,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; } @@ -11901,7 +11904,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje bool lootedObjectInDungeon = false; Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) - if (LFGDungeonEntry const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) + if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) lootedObjectInDungeon = true; @@ -16967,7 +16970,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 +17025,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(); } } @@ -17057,7 +17060,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) m_resetTalentsCost = fields[24].GetUInt32(); m_resetTalentsTime = time_t(fields[25].GetUInt32()); - m_taxi.LoadTaxiMask(fields[17].GetCString()); // must be before InitTaxiNodesForLevel + m_taxi.LoadTaxiMask(fields[17].GetString()); // must be before InitTaxiNodesForLevel uint32 extraflags = fields[31].GetUInt16(); @@ -17142,7 +17145,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 +17568,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 +17582,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 +17627,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 +17642,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 +17665,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 +17687,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 +17709,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 +17724,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 +17891,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 +18145,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 +18158,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 +18288,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; } @@ -18426,11 +18429,11 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report uint32 missingItem = 0; if (ar->item) { - if (!HasItemCount(ar->item, 1) && - (!ar->item2 || !HasItemCount(ar->item2, 1))) + if (!HasItemCount(ar->item) && + (!ar->item2 || !HasItemCount(ar->item2))) missingItem = ar->item; } - else if (ar->item2 && !HasItemCount(ar->item2, 1)) + else if (ar->item2 && !HasItemCount(ar->item2)) missingItem = ar->item2; if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, target_map, this)) @@ -18506,7 +18509,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 +19032,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 +19048,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 +19880,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 +19962,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 +19976,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 +21097,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 +21191,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()); } } @@ -22909,7 +22912,7 @@ uint32 Player::GetResurrectionSpellId() } // Reincarnation (passive spell) // prio: 1 // Glyph of Renewed Life - if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030, 1))) + if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030))) spell_id = 21169; return spell_id; @@ -23304,7 +23307,7 @@ bool Player::inRandomLfgDungeon() const LfgDungeonSet& dungeons = sLFGMgr->GetSelectedDungeons(GetGUID()); if (!dungeons.empty()) { - LFGDungeonEntry const* dungeon = sLFGMgr->GetLFGDungeon(*dungeons.begin()); + LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(*dungeons.begin()); if (dungeon && (dungeon->type == LFG_TYPE_RANDOM || dungeon->seasonal)) return true; } @@ -23460,11 +23463,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 +23479,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 +24778,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 +25240,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 9d80a17bc5e..21c31c720e7 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -911,7 +911,7 @@ class PlayerTaxi ~PlayerTaxi() {} // Nodes void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level); - void LoadTaxiMask(const char* data); + void LoadTaxiMask(std::string const& data); bool IsTaximaskNodeKnown(uint32 nodeidx) const { @@ -934,7 +934,7 @@ class PlayerTaxi void AppendTaximaskTo(ByteBuffer& data, bool all); // Destinations - bool LoadTaxiDestinationsFromString(const std::string& values, uint32 team); + bool LoadTaxiDestinationsFromString(std::string const& values, uint32 team); std::string SaveTaxiDestinationsToString(); void ClearTaxiDestinations() { m_TaxiDestinations.clear(); } @@ -1198,11 +1198,11 @@ class Player : public Unit, public GridObject<Player> void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false); uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn - void Say(const std::string& text, const uint32 language); - void Yell(const std::string& text, const uint32 language); - void TextEmote(const std::string& text); - void Whisper(const std::string& text, const uint32 language, uint64 receiver); - void BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std::string& text, uint32 language) const; + void Say(std::string const& text, const uint32 language); + void Yell(std::string const& text, const uint32 language); + void TextEmote(std::string const& text); + void Whisper(std::string const& text, const uint32 language, uint64 receiver); + void BuildPlayerChat(WorldPacket* data, uint8 msgtype, std::string const& text, uint32 language) const; /*********************************************************/ /*** STORAGE SYSTEM ***/ @@ -1239,7 +1239,7 @@ class Player : public Unit, public GridObject<Player> bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos); uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); } void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); } - bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const; + bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const; bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL); bool CanNoReagentCast(SpellInfo const* spellInfo) const; bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; @@ -1256,7 +1256,6 @@ class Player : public Unit, public GridObject<Player> return EQUIP_ERR_ITEM_NOT_FOUND; uint32 count = pItem->GetCount(); return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL); - } InventoryResult CanStoreItems(Item** pItem, int count) const; InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const; @@ -1661,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..85daf369f69 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) - { - } + FriendInfo(uint8 flags, std::string const& 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/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 17982a58061..db8a484ad76 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1865,7 +1865,7 @@ Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const } // name must be checked to correctness (if received) before call this function -uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const +uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const { uint64 guid = 0; @@ -7062,7 +7062,7 @@ void ObjectMgr::DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_ cell_guids.corpses.erase(player_guid); } -void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go) +void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go) { uint32 oldMSTime = getMSTime(); @@ -7075,7 +7075,6 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, if (!result) { sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); - return; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index bfedd8cd8d0..29ca353bdd7 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -665,11 +665,11 @@ class ObjectMgr void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const; - uint64 GetPlayerGUIDByName(std::string name) const; + uint64 GetPlayerGUIDByName(std::string const& name) const; bool GetPlayerNameByGUID(uint64 guid, std::string &name) const; uint32 GetPlayerTeamByGUID(uint64 guid) const; uint32 GetPlayerAccountIdByGUID(uint64 guid) const; - uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const; + uint32 GetPlayerAccountIdByPlayerName(std::string const& name) const; uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team); void GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost); @@ -1057,12 +1057,12 @@ class ObjectMgr // reserved names void LoadReservedPlayersNames(); - bool IsReservedName(const std::string& name) const; + bool IsReservedName(std::string const& name) const; // name with valid structure and symbols - static uint8 CheckPlayerName(const std::string& name, bool create = false); - static PetNameInvalidReason CheckPetName(const std::string& name); - static bool IsValidCharterName(const std::string& name); + static uint8 CheckPlayerName(std::string const& name, bool create = false); + static PetNameInvalidReason CheckPetName(std::string const& name); + static bool IsValidCharterName(std::string const& name); static bool CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names); @@ -1072,10 +1072,10 @@ class ObjectMgr if (itr == _gameTeleStore.end()) return NULL; return &itr->second; } - GameTele const* GetGameTele(const std::string& name) const; + GameTele const* GetGameTele(std::string const& name) const; GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; } bool AddGameTele(GameTele& data); - bool DeleteGameTele(const std::string& name); + bool DeleteGameTele(std::string const& name); TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const { @@ -1130,7 +1130,7 @@ class ObjectMgr // for wintergrasp only GraveYardContainer GraveYardStore; - static void AddLocaleString(const std::string& s, LocaleConstant locale, StringVector& data); + static void AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data); static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value) { if (data.size() > size_t(loc_idx) && !data[loc_idx].empty()) @@ -1222,7 +1222,7 @@ class ObjectMgr private: void LoadScripts(ScriptsType type); void CheckScripts(ScriptsType type, std::set<int32>& ids); - void LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go); + void LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go); void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count); MailLevelRewardContainer _mailLevelRewardStore; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index f4106730e49..59759b19ef5 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -104,12 +104,14 @@ bool Group::Create(Player* leader) m_leaderGuid = leaderGuid; m_leaderName = leader->GetName(); - m_groupType = (isBGGroup() || isBFGroup()) ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL; + if (isBGGroup() || isBFGroup()) + m_groupType = GROUPTYPE_BGRAID; if (m_groupType & GROUPTYPE_RAID) _initRaidSubGroupsCounter(); - m_lootMethod = GROUP_LOOT; + if (!isLFGGroup()) + m_lootMethod = GROUP_LOOT; m_lootThreshold = ITEM_QUALITY_UNCOMMON; m_looterGuid = leaderGuid; @@ -600,7 +602,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV if (isLFGGroup() && GetMembersCount() == 1) { Player* Leader = ObjectAccessor::FindPlayer(GetLeaderGUID()); - LFGDungeonEntry const* dungeon = sLFGMgr->GetLFGDungeon(sLFGMgr->GetDungeon(GetGUID())); + LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(sLFGMgr->GetDungeon(GetGUID())); if ((Leader && dungeon && Leader->isAlive() && Leader->GetMapId() != uint32(dungeon->map)) || !dungeon) { Disband(); @@ -2091,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()); } } } @@ -2099,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/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index dd1fb7cc6b6..9e4c7828b1b 100755 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -260,18 +260,18 @@ private: Member(uint32 guildId, uint64 guid, uint8 rankId) : m_guildId(guildId), m_guid(guid), m_logoutTime(::time(NULL)), m_rankId(rankId) { } void SetStats(Player* player); - void SetStats(const std::string& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId); + void SetStats(std::string const& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId); bool CheckStats() const; - void SetPublicNote(const std::string& publicNote); - void SetOfficerNote(const std::string& officerNote); + void SetPublicNote(std::string const& publicNote); + void SetOfficerNote(std::string const& officerNote); bool LoadFromDB(Field* fields); void SaveToDB(SQLTransaction& trans) const; void WritePacket(WorldPacket& data) const; uint64 GetGUID() const { return m_guid; } - std::string GetName() const { return m_name; } + std::string const& GetName() const { return m_name; } uint32 GetAccountId() const { return m_accountId; } uint8 GetRankId() const { return m_rankId; } @@ -414,7 +414,7 @@ private: { public: RankInfo(uint32 guildId) : m_guildId(guildId), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { } - RankInfo(uint32 guildId, uint8 rankId, const std::string& name, uint32 rights, uint32 money) : + RankInfo(uint32 guildId, uint8 rankId, std::string const& name, uint32 rights, uint32 money) : m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights), m_bankMoneyPerDay(money) { } void LoadFromDB(Field* fields); @@ -423,8 +423,8 @@ private: uint8 GetId() const { return m_rankId; } - std::string GetName() const { return m_name; } - void SetName(const std::string& name); + std::string const& GetName() const { return m_name; } + void SetName(std::string const& name); uint32 GetRights() const { return m_rights; } void SetRights(uint32 rights); @@ -471,8 +471,8 @@ private: data << m_icon; } - void SetInfo(const std::string& name, const std::string& icon); - void SetText(const std::string& text); + void SetInfo(std::string const& name, std::string const& icon); + void SetText(std::string const& text); void SendText(const Guild* guild, WorldSession* session) const; inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; } @@ -579,39 +579,39 @@ private: typedef std::vector<BankTab*> BankTabs; public: - static void SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, const std::string& param = ""); + static void SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, std::string const& param = ""); static void SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode); Guild(); ~Guild(); - bool Create(Player* pLeader, const std::string& name); + bool Create(Player* pLeader, std::string const& name); void Disband(); // Getters uint32 GetId() const { return m_id; } uint64 GetLeaderGUID() const { return m_leaderGuid; } - const std::string& GetName() const { return m_name; } - const std::string& GetMOTD() const { return m_motd; } - const std::string& GetInfo() const { return m_info; } + std::string const& GetName() const { return m_name; } + std::string const& GetMOTD() const { return m_motd; } + std::string const& GetInfo() const { return m_info; } // Handle client commands void HandleRoster(WorldSession* session = NULL); // NULL = broadcast void HandleQuery(WorldSession* session); - void HandleSetMOTD(WorldSession* session, const std::string& motd); - void HandleSetInfo(WorldSession* session, const std::string& info); + void HandleSetMOTD(WorldSession* session, std::string const& motd); + void HandleSetInfo(WorldSession* session, std::string const& info); void HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo); - void HandleSetLeader(WorldSession* session, const std::string& name); - void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, const std::string& name, const std::string& icon); - void HandleSetMemberNote(WorldSession* session, const std::string& name, const std::string& note, bool officer); - void HandleSetRankInfo(WorldSession* session, uint8 rankId, const std::string& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots); + void HandleSetLeader(WorldSession* session, std::string const& name); + void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string const& name, std::string const& icon); + void HandleSetMemberNote(WorldSession* session, std::string const& name, std::string const& note, bool officer); + void HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots); void HandleBuyBankTab(WorldSession* session, uint8 tabId); - void HandleInviteMember(WorldSession* session, const std::string& name); + void HandleInviteMember(WorldSession* session, std::string const& name); void HandleAcceptMember(WorldSession* session); void HandleLeaveMember(WorldSession* session); - void HandleRemoveMember(WorldSession* session, const std::string& name); - void HandleUpdateMemberRank(WorldSession* session, const std::string& name, bool demote); - void HandleAddNewRank(WorldSession* session, const std::string& name); + void HandleRemoveMember(WorldSession* session, std::string const& name); + void HandleUpdateMemberRank(WorldSession* session, std::string const& name, bool demote); + void HandleAddNewRank(WorldSession* session, std::string const& name); void HandleRemoveLowestRank(WorldSession* session); void HandleMemberDepositMoney(WorldSession* session, uint32 amount); bool HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair = false); @@ -641,7 +641,7 @@ public: bool Validate(); // Broadcasts - void BroadcastToGuild(WorldSession* session, bool officerOnly, const std::string& msg, uint32 language = LANG_UNIVERSAL) const; + void BroadcastToGuild(WorldSession* session, bool officerOnly, std::string const& msg, uint32 language = LANG_UNIVERSAL) const; void BroadcastPacketToRank(WorldPacket* packet, uint8 rankId) const; void BroadcastPacket(WorldPacket* packet) const; @@ -665,7 +665,7 @@ public: void SwapItemsWithInventory(Player* player, bool toChar, uint8 tabId, uint8 slotId, uint8 playerBag, uint8 playerSlotId, uint32 splitedAmount); // Bank tabs - void SetBankTabText(uint8 tabId, const std::string& text); + void SetBankTabText(uint8 tabId, std::string const& text); protected: uint32 m_id; @@ -708,7 +708,7 @@ private: Members::iterator itr = m_members.find(GUID_LOPART(guid)); return itr != m_members.end() ? itr->second : NULL; } - inline Member* GetMember(WorldSession* session, const std::string& name) + inline Member* GetMember(WorldSession* session, std::string const& name) { for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) if (itr->second->GetName() == name) @@ -731,7 +731,7 @@ private: // Creates default guild ranks with names in given locale void _CreateDefaultGuildRanks(LocaleConstant loc); // Creates new rank - void _CreateRank(const std::string& name, uint32 rights); + void _CreateRank(std::string const& name, uint32 rights); // Update account number when member added/removed from guild void _UpdateAccountsNumber(); bool _IsLeader(Player* player) const; diff --git a/src/server/game/Guilds/GuildMgr.h b/src/server/game/Guilds/GuildMgr.h index 9654fced227..1f2413581d8 100644 --- a/src/server/game/Guilds/GuildMgr.h +++ b/src/server/game/Guilds/GuildMgr.h @@ -32,7 +32,7 @@ public: Guild* GetGuildByLeader(uint64 guid) const; Guild* GetGuildById(uint32 guildId) const; - Guild* GetGuildByName(const std::string& guildName) const; + Guild* GetGuildByName(std::string const& guildName) const; std::string GetGuildNameById(uint32 guildId) const; void LoadGuilds(); 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..dc930b8a381 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); } @@ -1145,7 +1145,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) _charRenameCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); } -void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string newName) +void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName) { if (!result) { diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 711d7af4dc3..a1f1f07cb90 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); } @@ -607,14 +604,14 @@ void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket) sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); } -void WorldSession::SendPlayerNotFoundNotice(std::string name) +void WorldSession::SendPlayerNotFoundNotice(std::string const& name) { WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, name.size()+1); data << name; SendPacket(&data); } -void WorldSession::SendPlayerAmbiguousNotice(std::string name) +void WorldSession::SendPlayerAmbiguousNotice(std::string const& name) { WorldPacket data(SMSG_CHAT_PLAYER_AMBIGUOUS, name.size()+1); data << name; 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/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 4f208d33bde..96d21097e71 100755 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -46,7 +46,7 @@ void BuildPartyLockDungeonBlock(WorldPacket& data, const LfgLockPartyMap& lockMa void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data) { - if (!sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE) || + if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER) || (GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID() && (GetPlayer()->GetGroup()->GetMembersCount() == MAXGROUPSIZE || !GetPlayer()->GetGroup()->isLFGGroup()))) { @@ -165,7 +165,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data LFGDungeonMap& LfgDungeons = sLFGMgr->GetLFGDungeonMap(); for (LFGDungeonMap::const_iterator itr = LfgDungeons.begin(); itr != LfgDungeons.end(); ++itr) { - LFGDungeonEntry const& dungeon = itr->second; + LFGDungeonData const& dungeon = itr->second; if ((dungeon.type == LFG_TYPE_RANDOM || (dungeon.seasonal && sLFGMgr->IsSeasonActive(dungeon.id))) && dungeon.expansion <= expansion && dungeon.minlevel <= level && level <= dungeon.maxlevel) randomDungeons.insert(dungeon.Entry()); @@ -403,7 +403,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck& roleCheck) { for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it) { - LFGDungeonEntry const* dungeon = sLFGMgr->GetLFGDungeon(*it); + LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(*it); data << uint32(dungeon ? dungeon->Entry() : 0); // Dungeon } } @@ -552,7 +552,7 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal const& p dungeonEntry = (*playerDungeons.begin()); } - if (LFGDungeonEntry const* dungeon = sLFGMgr->GetLFGDungeon(dungeonEntry)) + if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonEntry)) dungeonEntry = dungeon->Entry(); data << uint32(dungeonEntry); // Dungeon 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..8928a7c15a1 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); @@ -555,7 +557,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data) _addFriendCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); } -void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string friendNote) +void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string const& friendNote) { if (!GetPlayer()) return; @@ -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/Mails/Mail.h b/src/server/game/Mails/Mail.h index 10095268ead..7c12ac1a1c6 100755 --- a/src/server/game/Mails/Mail.h +++ b/src/server/game/Mails/Mail.h @@ -119,7 +119,7 @@ class MailDraft explicit MailDraft(uint16 mailTemplateId, bool need_items = true) : m_mailTemplateId(mailTemplateId), m_mailTemplateItemsNeed(need_items), m_money(0), m_COD(0) {} - MailDraft(std::string subject, std::string body) + MailDraft(std::string const& subject, std::string const& body) : m_mailTemplateId(0), m_mailTemplateItemsNeed(false), m_subject(subject), m_body(body), m_money(0), m_COD(0) {} public: // Accessors uint16 GetMailTemplateId() const { return m_mailTemplateId; } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index c3c6befe2f9..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 @@ -2468,8 +2468,8 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (group && group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) - if (LFGDungeonEntry const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) - if (LFGDungeonEntry const* randomDungeon = sLFGMgr->GetLFGDungeon(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) + if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) + if (LFGDungeonData const* randomDungeon = sLFGMgr->GetLFGDungeon(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) if (uint32(dungeon->map) == GetId() && dungeon->difficulty == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM)) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } @@ -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/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 6868db35975..07bfd284a7d 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -990,6 +990,12 @@ enum TrinityStrings LANG_WORLD_CLOSED = 7523, LANG_WORLD_OPENED = 7524, + LANG_LFG_PLAYER_INFO = 9980, + LANG_LFG_GROUP_INFO = 9981, + LANG_LFG_NOT_IN_GROUP = 9982, + LANG_LFG_CLEAN = 9983, + LANG_LFG_OPTIONS = 9984, + LANG_LFG_OPTIONS_CHANGED = 9985, LANG_LFG_STATE_NONE = 9986, LANG_LFG_STATE_ROLECHECK = 9987, LANG_LFG_STATE_QUEUED = 9988, @@ -1098,4 +1104,3 @@ enum TrinityStrings // For other tables maybe 2000010000-2147483647 (max index) }; #endif - 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/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 7ced64930f8..39b5dcee211 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -61,6 +61,7 @@ void AddSC_guild_commandscript(); void AddSC_honor_commandscript(); void AddSC_instance_commandscript(); void AddSC_learn_commandscript(); +void AddSC_lfg_commandscript(); void AddSC_list_commandscript(); void AddSC_lookup_commandscript(); void AddSC_message_commandscript(); @@ -682,6 +683,7 @@ void AddCommandScripts() AddSC_instance_commandscript(); AddSC_learn_commandscript(); AddSC_lookup_commandscript(); + AddSC_lfg_commandscript(); AddSC_list_commandscript(); AddSC_message_commandscript(); AddSC_misc_commandscript(); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index a3a850ff1c1..18ff3b32d67 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -45,6 +45,12 @@ #include "WardenWin.h" #include "WardenMac.h" +namespace { + +std::string const DefaultPlayerName = "<none>"; + +} // namespace + bool MapSessionFilter::Process(WorldPacket* packet) { OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()]; @@ -137,29 +143,20 @@ WorldSession::~WorldSession() LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query } -/// Get the player name -std::string WorldSession::GetPlayerName(bool simple /* = true */) const - { - std::string name = "[Player: "; - uint32 guidLow = 0; +std::string const & WorldSession::GetPlayerName() const +{ + return _player != NULL ? _player->GetName() : DefaultPlayerName; +} - if (Player* player = GetPlayer()) - { - name.append(player->GetName()); - guidLow = player->GetGUIDLow(); - } - else - name.append("<none>"); +std::string WorldSession::GetPlayerInfo() const +{ + std::ostringstream ss; - if (!simple) - { - std::ostringstream ss; - ss << " (Guid: " << guidLow << ", Account: " << GetAccountId() << ")"; - name.append(ss.str()); - } + ss << "[Player: " << GetPlayerName() + << " (Guid: " << (_player != NULL ? _player->GetGUID() : 0) + << ", Account: " << GetAccountId() << ")]"; - name.append("]"); - return name; + return ss.str(); } /// Get player guid if available. Use for logging purposes only @@ -222,14 +219,14 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason) { sLog->outError(LOG_FILTER_OPCODES, "Received unexpected opcode %s Status: %s Reason: %s from %s", - GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerName(false).c_str()); + GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerInfo().c_str()); } /// Logging helper for unexpected opcodes void WorldSession::LogUnprocessedTail(WorldPacket* packet) { sLog->outError(LOG_FILTER_OPCODES, "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s", - uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerName(false).c_str()); + uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerInfo().c_str()); packet->print_storage(); } @@ -263,7 +260,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) if (packet->GetOpcode() >= NUM_MSG_TYPES) { sLog->outError(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() - , GetPlayerName(false).c_str()); + , GetPlayerInfo().c_str()); sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet)); } else @@ -347,11 +344,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) break; case STATUS_NEVER: sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() - , GetPlayerName(false).c_str()); + , GetPlayerInfo().c_str()); break; case STATUS_UNHANDLED: sLog->outDebug(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str() - , GetPlayerName(false).c_str()); + , GetPlayerInfo().c_str()); break; } } @@ -545,7 +542,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); @@ -619,25 +617,25 @@ const char *WorldSession::GetTrinityString(int32 entry) const void WorldSession::Handle_NULL(WorldPacket& recvPacket) { sLog->outError(LOG_FILTER_OPCODES, "Received unhandled opcode %s from %s" - , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str()); + , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket) { sLog->outError(LOG_FILTER_OPCODES, "Received opcode %s that must be processed in WorldSocket::OnRead from %s" - , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str()); + , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } void WorldSession::Handle_ServerSide(WorldPacket& recvPacket) { sLog->outError(LOG_FILTER_OPCODES, "Received server-side opcode %s from %s" - , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str()); + , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } void WorldSession::Handle_Deprecated(WorldPacket& recvPacket) { sLog->outError(LOG_FILTER_OPCODES, "Received deprecated opcode %s from %s" - , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str()); + , GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str()); } void WorldSession::SendAuthWaitQue(uint32 position) @@ -698,7 +696,7 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask) while (result->NextRow()); } -void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string data) +void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string const& data) { uint32 id = 0; uint32 index = 0; @@ -1178,7 +1176,7 @@ void WorldSession::ProcessQueryCallbacks() } } -void WorldSession::InitWarden(BigNumber* k, std::string os) +void WorldSession::InitWarden(BigNumber* k, std::string const& os) { if (os == "Win") { diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 3ff45bff3b1..e91ef9530c2 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -197,7 +197,7 @@ class CharacterCreateInfo friend class Player; protected: - CharacterCreateInfo(std::string name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId, + CharacterCreateInfo(std::string const& name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId, WorldPacket& data) : Name(name), Race(race), Class(cclass), Gender(gender), Skin(skin), Face(face), HairStyle(hairStyle), HairColor(hairColor), FacialHair(facialHair), OutfitId(outfitId), Data(data), CharCount(0) {} @@ -243,8 +243,8 @@ class WorldSession void SendPacket(WorldPacket const* packet); void SendNotification(const char *format, ...) ATTR_PRINTF(2, 3); void SendNotification(uint32 string_id, ...); - void SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName); - void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res, uint32 val = 0); + void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName *declinedName); + void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0); void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3); void SendSetPhaseShift(uint32 phaseShift); void SendQueryTimeResponse(); @@ -255,14 +255,16 @@ class WorldSession AccountTypes GetSecurity() const { return _security; } uint32 GetAccountId() const { return _accountId; } Player* GetPlayer() const { return _player; } - std::string GetPlayerName(bool simple = true) const; + std::string const& GetPlayerName() const; + std::string GetPlayerInfo() const; + uint32 GetGuidLow() const; void SetSecurity(AccountTypes security) { _security = security; } std::string const& GetRemoteAddress() { return m_Address; } void SetPlayer(Player* player); uint8 Expansion() const { return m_expansion; } - void InitWarden(BigNumber* k, std::string os); + void InitWarden(BigNumber* k, std::string const& os); /// Session in auth.queue currently void SetInQueue(bool state) { m_inQueue = state; } @@ -295,7 +297,7 @@ class WorldSession void SendNameQueryOpcode(uint64 guid); void SendTrainerList(uint64 guid); - void SendTrainerList(uint64 guid, const std::string& strTitle); + void SendTrainerList(uint64 guid, std::string const& strTitle); void SendListInventory(uint64 guid); void SendShowBank(uint64 guid); void SendTabardVendorActivate(uint64 guid); @@ -324,7 +326,7 @@ class WorldSession // Account Data AccountData* GetAccountData(AccountDataType type) { return &m_accountData[type]; } - void SetAccountData(AccountDataType type, time_t tm, std::string data); + void SetAccountData(AccountDataType type, time_t tm, std::string const& data); void SendAccountDataTimes(uint32 mask); void LoadGlobalAccountData(); void LoadAccountData(PreparedQueryResult result, uint32 mask); @@ -361,7 +363,7 @@ class WorldSession void SendDiscoverNewTaxiNode(uint32 nodeid); // Guild/Arena Team - void SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id); + void SendArenaTeamCommandResult(uint32 team_action, std::string const& team, std::string const& player, uint32 error_id); void SendNotInArenaTeamPacket(uint8 type); void SendPetitionShowList(uint64 guid); @@ -483,7 +485,7 @@ class WorldSession void HandleEmoteOpcode(WorldPacket& recvPacket); void HandleContactListOpcode(WorldPacket& recvPacket); void HandleAddFriendOpcode(WorldPacket& recvPacket); - void HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string friendNote); + void HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string const& friendNote); void HandleDelFriendOpcode(WorldPacket& recvPacket); void HandleAddIgnoreOpcode(WorldPacket& recvPacket); void HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result); @@ -702,8 +704,8 @@ class WorldSession bool processChatmessageFurtherAfterSecurityChecks(std::string&, uint32); void HandleMessagechatOpcode(WorldPacket& recvPacket); - void SendPlayerNotFoundNotice(std::string name); - void SendPlayerAmbiguousNotice(std::string name); + void SendPlayerNotFoundNotice(std::string const& name); + void SendPlayerAmbiguousNotice(std::string const& name); void SendWrongFactionNotice(); void SendChatRestrictedNotice(ChatRestrictionType restriction); void HandleTextEmoteOpcode(WorldPacket& recvPacket); @@ -763,7 +765,7 @@ class WorldSession void HandleSetActionBarToggles(WorldPacket& recv_data); void HandleCharRenameOpcode(WorldPacket& recv_data); - void HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string newName); + void HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName); void HandleSetPlayerDeclinedNames(WorldPacket& recv_data); void HandleTotemDestroyed(WorldPacket& recv_data); diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 92455f8edfe..ee54c8d662c 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; @@ -683,7 +683,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) case CMSG_AUTH_SESSION: if (m_Session) { - sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerName(false).c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerInfo().c_str()); return -1; } @@ -1006,7 +1006,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity())) { sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)", - m_Session->GetPlayerName(false).c_str(), GetRemoteAddress().c_str()); + m_Session->GetPlayerInfo().c_str(), GetRemoteAddress().c_str()); return -1; } 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 295c8216b7f..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" @@ -5846,7 +5848,7 @@ SpellCastResult Spell::CheckItems() else { uint32 itemid = m_CastItem->GetEntry(); - if (!p_caster->HasItemCount(itemid, 1)) + if (!p_caster->HasItemCount(itemid)) return SPELL_FAILED_ITEM_NOT_READY; ItemTemplate const* proto = m_CastItem->GetTemplate(); @@ -5998,7 +6000,7 @@ SpellCastResult Spell::CheckItems() { if (m_spellInfo->Totem[i] != 0) { - if (p_caster->HasItemCount(m_spellInfo->Totem[i], 1)) + if (p_caster->HasItemCount(m_spellInfo->Totem[i])) { totems -= 1; continue; @@ -6053,7 +6055,7 @@ SpellCastResult Spell::CheckItems() { if (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x40000000))) return SPELL_FAILED_TOO_MANY_OF_ITEM; - else if (!(p_caster->HasItemCount(m_spellInfo->Effects[i].ItemType, 1))) + else if (!(p_caster->HasItemCount(m_spellInfo->Effects[i].ItemType))) return SPELL_FAILED_TOO_MANY_OF_ITEM; else p_caster->CastSpell(m_caster, m_spellInfo->Effects[EFFECT_1].CalcValue(), false); // move this to anywhere @@ -6232,7 +6234,7 @@ SpellCastResult Spell::CheckItems() case ITEM_SUBCLASS_WEAPON_THROWN: { uint32 ammo = pItem->GetEntry(); - if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) + if (!m_caster->ToPlayer()->HasItemCount(ammo)) return SPELL_FAILED_NO_AMMO; }; break; @@ -6273,7 +6275,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; } - if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) + if (!m_caster->ToPlayer()->HasItemCount(ammo)) { m_caster->ToPlayer()->SetUInt32Value(PLAYER_AMMO_ID, 0); return SPELL_FAILED_NO_AMMO; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index cc032a5895b..6709bde541b 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1778,7 +1778,7 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex) { if (item_id) { - if (!player->HasItemCount(item_id, 1)) + if (!player->HasItemCount(item_id)) return; // remove reagent @@ -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/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 06f1187a833..4ffbab6cb63 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3593,6 +3593,10 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE; spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS; break; + case 75888: // Awaken Flames + case 75889: // Awaken Flames + spellInfo->AttributesEx |= SPELL_ATTR1_CANT_TARGET_SELF; + break; // ENDOF RUBY SANCTUM SPELLS // case 40055: // Introspection diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index b1a2097a8f9..26dda4d2327 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -72,6 +72,8 @@ class _SpellScript { public: EffectHook(uint8 _effIndex); + virtual ~EffectHook() { } + uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry); bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex); virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0; @@ -83,7 +85,7 @@ class _SpellScript class EffectNameCheck { public: - EffectNameCheck(uint16 _effName) {effName = _effName;}; + EffectNameCheck(uint16 _effName) { effName = _effName; } bool Check(SpellInfo const* spellEntry, uint8 effIndex); std::string ToString(); private: @@ -118,7 +120,7 @@ class _SpellScript virtual bool Load() { return true; } // Function called when script is destroyed // use for: deallocating memory allocated by script - virtual void Unload() {} + virtual void Unload() { } }; // SpellScript interface - enum used for runtime checks of script function calls 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/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index 63837e39452..7e6768b96b2 100755 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -94,8 +94,8 @@ public: uint32 GetId() const { return _id; } Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); } - std::string GetPlayerName() const { return _playerName; } - std::string GetMessage() const { return _message; } + std::string const& GetPlayerName() const { return _playerName; } + std::string const& GetMessage() const { return _message; } Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); } uint64 GetAssignedToGUID() const { return _assignedTo; } std::string GetAssignedToName() const @@ -120,16 +120,16 @@ public: _escalatedStatus = TICKET_ASSIGNED; } void SetClosedBy(const int64& value) { _closedBy = value; } - void SetMessage(const std::string& message) + void SetMessage(std::string const& message) { _message = message; _lastModifiedTime = uint64(time(NULL)); } - void SetComment(const std::string& comment) { _comment = comment; } + void SetComment(std::string const& comment) { _comment = comment; } void SetViewed() { _viewed = true; } void SetUnassigned(); - void AppendResponse(const std::string& response) { _response += response; } + void AppendResponse(std::string const& response) { _response += response; } bool LoadFromDB(Field* fields); void SaveToDB(SQLTransaction& trans) const; @@ -143,7 +143,7 @@ public: std::string FormatMessageString(ChatHandler& handler, const char* szClosedName, const char* szAssignedToName, const char* szUnassignedName, const char* szDeletedName) const; void SetChatLog(std::list<uint32> time, std::string const& log); - std::string GetChatLog() const { return _chatLog; } + std::string const& GetChatLog() const { return _chatLog; } private: uint32 _id; diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index ef516a0ba4f..ec7d2e08001 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -117,7 +117,7 @@ std::string gettablename(std::string &str) return str.substr(s, e-s); } -bool changenth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false) +bool changenth(std::string &str, int n, char const* with, bool insert = false, bool nonzero = false) { std::string::size_type s, e; if (!findnth(str, n, s, e)) @@ -142,7 +142,7 @@ std::string getnth(std::string &str, int n) return str.substr(s, e-s); } -bool changetoknth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false) +bool changetoknth(std::string &str, int n, char const* with, bool insert = false, bool nonzero = false) { std::string::size_type s = 0, e = 0; if (!findtoknth(str, n, s, e)) @@ -198,7 +198,7 @@ std::string CreateDumpString(char const* tableName, QueryResult result) { if (!tableName || !result) return ""; std::ostringstream ss; - ss << "INSERT INTO "<< _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES ("; + ss << "INSERT INTO " << _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES ("; Field* fields = result->Fetch(); for (uint32 i = 0; i < result->GetFieldCount(); ++i) { @@ -395,7 +395,7 @@ void fixNULLfields(std::string &line) } } -DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid) +DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, std::string name, uint32 guid) { uint32 charcount = AccountMgr::GetCharactersCount(account); if (charcount >= 10) diff --git a/src/server/game/Tools/PlayerDump.h b/src/server/game/Tools/PlayerDump.h index 6662d91fb31..321649fc485 100755 --- a/src/server/game/Tools/PlayerDump.h +++ b/src/server/game/Tools/PlayerDump.h @@ -73,7 +73,7 @@ class PlayerDumpWriter : public PlayerDump PlayerDumpWriter() {} bool GetDump(uint32 guid, std::string& dump); - DumpReturn WriteDump(const std::string& file, uint32 guid); + DumpReturn WriteDump(std::string const& file, uint32 guid); private: typedef std::set<uint32> GUIDs; @@ -91,8 +91,7 @@ class PlayerDumpReader : public PlayerDump public: PlayerDumpReader() {} - DumpReturn LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid); + DumpReturn LoadDump(std::string const& file, uint32 account, std::string name, uint32 guid); }; #endif - diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index d651fbd4ce1..ce64dbd1a94 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -106,7 +106,7 @@ void Warden::Update() if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS) { sLog->outWarn(LOG_FILTER_WARDEN, "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client", - _session->GetPlayerName(false).c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str()); + _session->GetPlayerInfo().c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str()); _session->KickPlayer(); } else diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 9c90662105a..e08d24ecbcd 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -152,7 +152,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff) // Verify key if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0) { - sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 20f09ec5bda..3d5f27f6a31 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -156,7 +156,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff) // Verify key if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0) { - sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } @@ -341,7 +341,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length)) { buff.rpos(buff.wpos()); - sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } @@ -352,7 +352,7 @@ void WardenWin::HandleData(ByteBuffer &buff) // TODO: test it. if (result == 0x00) { - sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } @@ -494,7 +494,7 @@ void WardenWin::HandleData(ByteBuffer &buff) if (checkFailed > 0) { WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed); - sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerName(false).c_str(), checkFailed, Penalty(check).c_str()); + sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerInfo().c_str(), checkFailed, Penalty(check).c_str()); } // Set hold off timer, minimum timer should at least be 1 second diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 35f991cd368..10a1581906f 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1182,7 +1182,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_WARDEN_CLIENT_RESPONSE_DELAY] = ConfigMgr::GetIntDefault("Warden.ClientResponseDelay", 600); // Dungeon finder - m_bool_configs[CONFIG_DUNGEON_FINDER_ENABLE] = ConfigMgr::GetBoolDefault("DungeonFinder.Enable", false); + m_int_configs[CONFIG_LFG_OPTIONSMASK] = ConfigMgr::GetIntDefault("DungeonFinder.OptionsMask", 1); // DBC_ItemAttributes m_bool_configs[CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES] = ConfigMgr::GetBoolDefault("DBC.EnforceItemAttributes", true); @@ -1461,16 +1461,6 @@ void World::SetInitialWorldSettings() sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories..."); sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG entrance positions..."); - sLFGMgr->LoadLFGDungeons(); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data..."); - sObjectMgr->LoadInstanceEncounters(); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards..."); - sLFGMgr->LoadRewards(); - - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load sSpellMgr->LoadSpellAreas(); @@ -1489,6 +1479,15 @@ void World::SetInitialWorldSettings() sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names..."); sObjectMgr->LoadAreaTriggerScripts(); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG entrance positions..."); // Must be after areatriggers + sLFGMgr->LoadLFGDungeons(); + + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data..."); + sObjectMgr->LoadInstanceEncounters(); + + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards..."); + sLFGMgr->LoadRewards(); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links..."); sObjectMgr->LoadGraveyardZones(); @@ -2268,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 @@ -2346,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) @@ -2375,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); @@ -2416,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 66b52549e93..9046486a181 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -155,7 +155,6 @@ enum WorldBoolConfigs CONFIG_CHATLOG_PUBLIC, CONFIG_CHATLOG_ADDON, CONFIG_CHATLOG_BGROUND, - CONFIG_DUNGEON_FINDER_ENABLE, CONFIG_AUTOBROADCAST, CONFIG_ALLOW_TICKETS, CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES, @@ -313,6 +312,7 @@ enum WorldIntConfigs CONFIG_DB_PING_INTERVAL, CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION, CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS, + CONFIG_LFG_OPTIONSMASK, CONFIG_MAX_INSTANCES_PER_HOUR, CONFIG_WARDEN_CLIENT_RESPONSE_DELAY, CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF, @@ -605,19 +605,19 @@ class World void SetAllowMovement(bool allow) { m_allowMovement = allow; } /// Set a new Message of the Day - void SetMotd(const std::string& motd); + void SetMotd(std::string const& motd); /// Get the current Message of the Day const char* GetMotd() const; /// Set the string for new characters (first login) - void SetNewCharString(std::string str) { m_newCharString = str; } + void SetNewCharString(std::string const& str) { m_newCharString = str; } /// Get the string for new characters (first login) - const std::string& GetNewCharString() const { return m_newCharString; } + std::string const& GetNewCharString() const { return m_newCharString; } LocaleConstant GetDefaultDbcLocale() const { return m_defaultDbcLocale; } /// Get the path where data (dbc, maps) are stored on disk - std::string GetDataPath() const { return m_dataPath; } + std::string const& GetDataPath() const { return m_dataPath; } /// When server started? time_t const& GetStartTime() const { return m_startTime; } @@ -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/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 177b3a479f5..a65324a9f42 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -27,6 +27,7 @@ set(scripts_STAT_SRCS Commands/cs_honor.cpp Commands/cs_instance.cpp Commands/cs_learn.cpp + Commands/cs_lfg.cpp Commands/cs_list.cpp Commands/cs_lookup.cpp Commands/cs_message.cpp 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 new file mode 100644 index 00000000000..e07458ac691 --- /dev/null +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "Chat.h" +#include "LFGMgr.h" +#include "Group.h" + +void GetPlayerInfo(ChatHandler* handler, Player* player) +{ + if (!player) + return; + + uint64 guid = player->GetGUID(); + LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(guid); + + char const * const state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid)); + 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()); +} + +class lfg_commandscript : public CommandScript +{ +public: + lfg_commandscript() : CommandScript("lfg_commandscript") { } + + ChatCommand* GetCommands() const + { + static ChatCommand lfgCommandTable[] = + { + { "player", SEC_GAMEMASTER, false, &HandleLfgPlayerInfoCommand, "", NULL }, + { "group", SEC_GAMEMASTER, false, &HandleLfgGroupInfoCommand, "", NULL }, + { "queue", SEC_GAMEMASTER, false, &HandleLfgQueueInfoCommand, "", NULL }, + { "clean", SEC_ADMINISTRATOR, false, &HandleLfgCleanCommand, "", NULL }, + { "options", SEC_ADMINISTRATOR, false, &HandleLfgOptionsCommand, "", NULL }, + { NULL, SEC_PLAYER, false, NULL, "", NULL } + }; + + static ChatCommand commandTable[] = + { + { "lfg", SEC_GAMEMASTER, false, NULL, "", lfgCommandTable }, + { NULL, SEC_PLAYER, false, NULL, "", NULL } + }; + return commandTable; + } + + static bool HandleLfgPlayerInfoCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + std::string playerName; + if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + return false; + + GetPlayerInfo(handler, target); + return true; + } + + static bool HandleLfgGroupInfoCommand(ChatHandler* handler, char const* args) + { + Player* target = NULL; + std::string playerName; + if (!handler->extractPlayerTarget((char*)args, &target, NULL, &playerName)) + return false; + + Group* grp = target->GetGroup(); + if (!grp) + { + handler->PSendSysMessage(LANG_LFG_NOT_IN_GROUP, playerName.c_str()); + return true; + } + + uint64 guid = grp->GetGUID(); + char const * const state = sLFGMgr->GetStateString(sLFGMgr->GetState(guid)); + handler->PSendSysMessage(LANG_LFG_GROUP_INFO, grp->isLFGGroup(), + state, sLFGMgr->GetDungeon(guid)); + + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + GetPlayerInfo(handler, itr->getSource()); + + return true; + } + + static bool HandleLfgOptionsCommand(ChatHandler* handler, char const* args) + { + int32 options = -1; + if (char* str = strtok((char*)args, " ")) + { + int32 tmp = atoi(str); + if (tmp > -1) + options = tmp; + } + + if (options != -1) + { + sLFGMgr->SetOptions(options); + handler->PSendSysMessage(LANG_LFG_OPTIONS_CHANGED); + } + handler->PSendSysMessage(LANG_LFG_OPTIONS, sLFGMgr->GetOptions()); + return true; + } + + static bool HandleLfgQueueInfoCommand(ChatHandler* handler, char const* /*args*/) + { + handler->SendSysMessage(sLFGMgr->DumpQueueInfo().c_str()); + return true; + } + + static bool HandleLfgCleanCommand(ChatHandler* handler, char const* /*args*/) + { + handler->PSendSysMessage(LANG_LFG_CLEAN); + sLFGMgr->Clean(); + return true; + } +}; + +void AddSC_lfg_commandscript() +{ + new lfg_commandscript(); +} 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/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 7286466d335..263897edfad 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -546,7 +546,7 @@ public: if (player->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && !player->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) && - player->HasItemCount(ITEM_SULFURON_INGOT, 1)) + player->HasItemCount(ITEM_SULFURON_INGOT)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index f1aa3d68bce..8f79c4973f7 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -30,40 +30,32 @@ Script Data End */ #define GOSSIP_START_EVENT "I am ready to being" -enum eBlastmasterEmiShortfuse +enum BlastmasterEmi { GOSSIP_TEXT_EMI = 1693, - SAY_BLASTMASTER_0 = -1090000, - SAY_BLASTMASTER_1 = -1090001, - SAY_BLASTMASTER_2 = -1090002, - SAY_BLASTMASTER_3 = -1090003, - SAY_BLASTMASTER_4 = -1090004, - SAY_BLASTMASTER_5 = -1090005, - SAY_BLASTMASTER_6 = -1090006, - SAY_BLASTMASTER_7 = -1090007, - SAY_BLASTMASTER_8 = -1090008, - SAY_BLASTMASTER_9 = -1090009, - SAY_BLASTMASTER_10 = -1090010, - SAY_BLASTMASTER_11 = -1090011, - SAY_BLASTMASTER_12 = -1090012, - SAY_BLASTMASTER_13 = -1090013, - SAY_BLASTMASTER_14 = -1090014, - SAY_BLASTMASTER_15 = -1090015, - SAY_BLASTMASTER_16 = -1090016, - SAY_BLASTMASTER_17 = -1090017, - SAY_BLASTMASTER_18 = -1090018, - SAY_BLASTMASTER_19 = -1090019, - SAY_BLASTMASTER_20 = -1090020, - SAY_BLASTMASTER_21 = -1090021, - SAY_BLASTMASTER_22 = -1090022, - SAY_BLASTMASTER_23 = -1090023, - SAY_BLASTMASTER_24 = -1090024, - SAY_BLASTMASTER_25 = -1090025, - SAY_BLASTMASTER_26 = -1090026, - SAY_BLASTMASTER_27 = -1090027, - - SAY_GRUBBIS = -1090028 + SAY_BLASTMASTER_0 = 0, + SAY_BLASTMASTER_1 = 1, + SAY_BLASTMASTER_2 = 2, + SAY_BLASTMASTER_3 = 3, + SAY_BLASTMASTER_4 = 4, + SAY_BLASTMASTER_5 = 5, + SAY_BLASTMASTER_6 = 6, + SAY_BLASTMASTER_7 = 7, + SAY_BLASTMASTER_8 = 8, + SAY_BLASTMASTER_9 = 9, + SAY_BLASTMASTER_10 = 10, + SAY_BLASTMASTER_11 = 11, + SAY_BLASTMASTER_12 = 12, + SAY_BLASTMASTER_13 = 13, + SAY_BLASTMASTER_14 = 14, + SAY_BLASTMASTER_15 = 15, + SAY_BLASTMASTER_16 = 16, + SAY_BLASTMASTER_17 = 17, + SAY_BLASTMASTER_18 = 18, + SAY_BLASTMASTER_19 = 19, + + SAY_GRUBBIS = 0 }; const Position SpawnPosition[] = @@ -78,13 +70,16 @@ const Position SpawnPosition[] = {-552.534f, -110.012f, -153.577f, 0.747f}, {-550.708f, -116.436f, -153.103f, 0.679f}, {-554.030f, -115.983f, -152.635f, 0.695f}, - {-494.595f, -87.516f, 149.116f, 3.344f}, + {-494.595f, -87.516f, -149.116f, 3.344f}, {-493.349f, -90.845f, -148.882f, 3.717f}, {-491.995f, -87.619f, -148.197f, 3.230f}, {-490.732f, -90.739f, -148.091f, 3.230f}, {-490.554f, -89.114f, -148.055f, 3.230f}, {-495.240f, -90.808f, -149.493f, 3.238f}, - {-494.195f, -89.553f, -149.131f, 3.254f} + {-494.195f, -89.553f, -149.131f, 3.254f}, + {-511.3304f, -139.9622f, -152.4761f, 0.7504908f}, + {-510.6754f, -139.4371f, -152.6167f, 3.33359f}, + {-511.8976f, -139.3562f, -152.4785f, 3.961899f} }; class npc_blastmaster_emi_shortfuse : public CreatureScript @@ -300,12 +295,12 @@ public: NextStep(25000, false, 18); break; case 13: - Summon(7); + Summon(6); NextStep(25000, false, 19); break; case 14: SetInFace(false); - DoScriptText(SAY_BLASTMASTER_26, me); + Talk(SAY_BLASTMASTER_17); SetEscortPaused(true); NextStep(5000, false, 20); break; @@ -318,8 +313,8 @@ public: { case 1: SetEscortPaused(true); - DoScriptText(SAY_BLASTMASTER_0, me); - NextStep(1500, true); + Talk(SAY_BLASTMASTER_0); + NextStep(2000, true); break; case 2: if (!instance) @@ -368,7 +363,7 @@ public: me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - DoScriptText(SAY_BLASTMASTER_19, me); + Talk(SAY_BLASTMASTER_7); break; case 4: if (GameObject* go = me->SummonGameObject(183410, -542.199f, -96.854f, -155.790f, 0, 0, 0, 0, 0, 1000)) @@ -378,38 +373,37 @@ public: } break; case 5: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - DoScriptText(SAY_BLASTMASTER_15, me); - break; - case 6: me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); break; - case 7: + case 6: if (GameObject* go = me->SummonGameObject(183410, -507.820f, -103.333f, -151.353f, 0, 0, 0, 0, 0, 1000)) { GoSummonList.push_back(go->GetGUID()); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it! - Summon(6); + Summon(5); } break; - case 8: + case 7: if (GameObject* go = me->SummonGameObject(183410, -511.829f, -86.249f, -151.431f, 0, 0, 0, 0, 0, 1000)) { GoSummonList.push_back(go->GetGUID()); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it! } break; - case 9: - if (Creature* pGrubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000)) - DoScriptText(SAY_GRUBBIS, pGrubbis); + case 8: + if (Creature* grubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000)) + grubbis->AI()->Talk(SAY_GRUBBIS); me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); break; + case 9: + me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[17].GetPositionX(), SpawnPosition[17].GetPositionY(), SpawnPosition[17].GetPositionZ(), SpawnPosition[17].GetOrientation(), 0, 0, 0, 0, 7200); + me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[18].GetPositionX(), SpawnPosition[18].GetPositionY(), SpawnPosition[18].GetPositionZ(), SpawnPosition[18].GetOrientation(), 0, 0, 0, 0, 7200); + me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[19].GetPositionX(), SpawnPosition[19].GetPositionY(), SpawnPosition[19].GetPositionZ(), SpawnPosition[19].GetOrientation(), 0, 0, 0, 0, 7200); + break; } } @@ -422,29 +416,29 @@ public: switch (uiPhase) { case 1: - DoScriptText(SAY_BLASTMASTER_1, me); - NextStep(1500, true); + Talk(SAY_BLASTMASTER_1); + NextStep(2000, true); break; case 2: SetEscortPaused(false); NextStep(0, false, 0); break; case 3: - DoScriptText(SAY_BLASTMASTER_2, me); + Talk(SAY_BLASTMASTER_2); SetEscortPaused(false); NextStep(0, false, 0); break; case 4: - DoScriptText(SAY_BLASTMASTER_3, me); + Talk(SAY_BLASTMASTER_3); NextStep(3000, true); break; case 5: - DoScriptText(SAY_BLASTMASTER_4, me); + Talk(SAY_BLASTMASTER_4); NextStep(3000, true); break; case 6: SetInFace(true); - DoScriptText(SAY_BLASTMASTER_5, me); + Talk(SAY_BLASTMASTER_5); Summon(1); if (instance) if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) @@ -452,12 +446,12 @@ public: NextStep(3000, true); break; case 7: - DoScriptText(SAY_BLASTMASTER_6, me); + Talk(SAY_BLASTMASTER_6); SetEscortPaused(false); NextStep(0, false, 0); break; case 8: - me->HandleEmoteCommand(EMOTE_STATE_WORK); + me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING); NextStep(25000, true); break; case 9: @@ -466,31 +460,32 @@ public: break; case 10: Summon(4); + Talk(SAY_BLASTMASTER_8); NextStep(0, false); break; case 11: - DoScriptText(SAY_BLASTMASTER_17, me); + Talk(SAY_BLASTMASTER_9); NextStep(5000, true); break; case 12: - DoScriptText(SAY_BLASTMASTER_18, me); + Talk(SAY_BLASTMASTER_10); NextStep(5000, true); break; case 13: - DoScriptText(SAY_BLASTMASTER_20, me); + Talk(SAY_BLASTMASTER_11); CaveDestruction(true); NextStep(8000, true); break; case 14: - DoScriptText(SAY_BLASTMASTER_21, me); + Talk(SAY_BLASTMASTER_12); NextStep(8500, true); break; case 15: - DoScriptText(SAY_BLASTMASTER_22, me); + Talk(SAY_BLASTMASTER_13); NextStep(2000, true); break; case 16: - DoScriptText(SAY_BLASTMASTER_23, me); + Talk(SAY_BLASTMASTER_14); SetInFace(false); if (instance) if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) @@ -499,31 +494,36 @@ public: break; case 17: SetEscortPaused(false); - DoScriptText(SAY_BLASTMASTER_24, me); - Summon(6); + Talk(SAY_BLASTMASTER_15); + Summon(5); NextStep(0, false); break; case 18: - Summon(7); + Summon(6); NextStep(0, false); break; case 19: SetInFace(false); - Summon(8); - DoScriptText(SAY_BLASTMASTER_25, me); + Summon(7); + Talk(SAY_BLASTMASTER_16); NextStep(0, false); break; case 20: - DoScriptText(SAY_BLASTMASTER_27, me); + Talk(SAY_BLASTMASTER_18); NextStep(2000, true); break; case 21: - Summon(9); + Summon(8); NextStep(0, false); break; case 22: CaveDestruction(false); - DoScriptText(SAY_BLASTMASTER_20, me); + Talk(SAY_BLASTMASTER_11); + NextStep(3000, true); + break; + case 23: + Summon(9); + Talk(SAY_BLASTMASTER_19); NextStep(0, false); break; } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h index a62cf9f9cae..068ba5d26af 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h @@ -21,7 +21,8 @@ enum eGameObjects { GO_CAVE_IN_LEFT = 146085, - GO_CAVE_IN_RIGHT = 146086 + GO_CAVE_IN_RIGHT = 146086, + GO_RED_ROCKET = 103820 }; enum eCreatures diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp index 3d8e68dfbf8..75109f3a2f6 100644 --- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp @@ -60,7 +60,7 @@ public: bool OnGossipHello(Player* player, Creature* creature) { - if (player->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(10757, 1)) + if (player->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(10757)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); 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/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index ee7ef383603..48dd847b190 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -236,7 +236,7 @@ public: uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); // Only let them get item if Azgalor is dead. - if (AzgalorEvent == DONE && !player->HasItemCount(ITEM_TEAR_OF_GODDESS, 1)) + if (AzgalorEvent == DONE && !player->HasItemCount(ITEM_TEAR_OF_GODDESS)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(907, creature->GetGUID()); return true; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index ee8c4d1bae1..bed3cde6fa4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -388,13 +388,13 @@ public: if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if (player->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(ITEM_CHRONO_BEACON, 1)) + if (player->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(ITEM_CHRONO_BEACON)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_OBTAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10000, creature->GetGUID()); return true; } - else if (player->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !player->HasItemCount(ITEM_CHRONO_BEACON, 1)) + else if (player->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !player->HasItemCount(ITEM_CHRONO_BEACON)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_OBTAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(10001, creature->GetGUID()); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 3690e87354d..0158d470ef9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -79,7 +79,7 @@ public: player->PrepareQuestMenu(creature->GetGUID()); InstanceScript* instance = creature->GetInstanceScript(); - if (instance && instance->GetData(TYPE_BARREL_DIVERSION) != DONE && !player->HasItemCount(ITEM_ENTRY_BOMBS, 1)) + if (instance && instance->GetData(TYPE_BARREL_DIVERSION) != DONE && !player->HasItemCount(ITEM_ENTRY_BOMBS)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); if (player->GetQuestStatus(QUEST_ENTRY_RETURN) == QUEST_STATUS_COMPLETE) diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp index 4fcd20951c9..c1e247044f7 100644 --- a/src/server/scripts/Kalimdor/feralas.cpp +++ b/src/server/scripts/Kalimdor/feralas.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" +#include "SpellScript.h" /*###### ## npc_gregan_brewspewer @@ -202,6 +203,39 @@ public: }; +enum GordunniTrap +{ + GO_GORDUNNI_DIRT_MOUND = 144064, +}; + +class spell_gordunni_trap : public SpellScriptLoader +{ + public: + spell_gordunni_trap() : SpellScriptLoader("spell_gordunni_trap") { } + + class spell_gordunni_trap_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gordunni_trap_SpellScript); + + void HandleDummy() + { + if (Unit* caster = GetCaster()) + if (GameObject* chest = caster->SummonGameObject(GO_GORDUNNI_DIRT_MOUND, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0)) + chest->SetSpellId(GetSpellInfo()->Id); + } + + void Register() + { + OnCast += SpellCastFn(spell_gordunni_trap_SpellScript::HandleDummy); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gordunni_trap_SpellScript(); + } +}; + /*###### ## AddSC ######*/ @@ -211,4 +245,5 @@ void AddSC_feralas() new npc_gregan_brewspewer(); new npc_oox22fe(); new npc_screecher_spirit(); + new spell_gordunni_trap(); } diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index bad278f51c7..45a2fad9999 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -1289,37 +1289,37 @@ class go_wind_stone : public GameObjectScript { case TEMPLAR: { - if (player->HasItemCount(ITEM_TEMPLAR_FIRE, 1)) + if (player->HasItemCount(ITEM_TEMPLAR_FIRE)) result |= FIRE; - if (player->HasItemCount(ITEM_TEMPLAR_WATER, 1)) + if (player->HasItemCount(ITEM_TEMPLAR_WATER)) result |= WATER; - if (player->HasItemCount(ITEM_TEMPLAR_EARTH, 1)) + if (player->HasItemCount(ITEM_TEMPLAR_EARTH)) result |= EARTH; - if (player->HasItemCount(ITEM_TEMPLAR_AIR, 1)) + if (player->HasItemCount(ITEM_TEMPLAR_AIR)) result |= AIR; break; } case DUKE: { - if (player->HasItemCount(ITEM_DUKE_FIRE, 1)) + if (player->HasItemCount(ITEM_DUKE_FIRE)) result |= FIRE; - if (player->HasItemCount(ITEM_DUKE_WATER, 1)) + if (player->HasItemCount(ITEM_DUKE_WATER)) result |= WATER; - if (player->HasItemCount(ITEM_DUKE_EARTH, 1)) + if (player->HasItemCount(ITEM_DUKE_EARTH)) result |= EARTH; - if (player->HasItemCount(ITEM_DUKE_AIR, 1)) + if (player->HasItemCount(ITEM_DUKE_AIR)) result |= AIR; break; } case ROYAL: { - if (player->HasItemCount(ITEM_ROYAL_FIRE, 1)) + if (player->HasItemCount(ITEM_ROYAL_FIRE)) result |= FIRE; - if (player->HasItemCount(ITEM_ROYAL_WATER, 1)) + if (player->HasItemCount(ITEM_ROYAL_WATER)) result |= WATER; - if (player->HasItemCount(ITEM_ROYAL_EARTH, 1)) + if (player->HasItemCount(ITEM_ROYAL_EARTH)) result |= EARTH; - if (player->HasItemCount(ITEM_ROYAL_AIR, 1)) + if (player->HasItemCount(ITEM_ROYAL_AIR)) result |= AIR; break; } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 6ba13014585..059f513f12c 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -113,6 +113,8 @@ enum Spells SPELL_SUMMON_EXIT_PORTALS = 74805, // Custom spell created in spell_dbc. SPELL_TWILIGHT_MENDING = 75509, SPELL_TWILIGHT_REALM = 74807, + SPELL_DUSK_SHROUD = 75476, + SPELL_TWILIGHT_PRECISION = 78243, SPELL_COPY_DAMAGE = 74810 // Aura not found in DBCs. }; @@ -226,19 +228,24 @@ struct generic_halionAI : public BossAI { generic_halionAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId), _canEvade(false) { } - void EnterCombat(Unit* /*who*/) + void EnterCombat(Unit* who) { - Talk(SAY_AGGRO); - _EnterCombat(); + BossAI::EnterCombat(who); _canEvade = false; - events.Reset(); events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); + events.ScheduleEvent(EVENT_TAIL_LASH, 10000); + } + + void Reset() + { + _canEvade = false; + BossAI::Reset(); } void EnterEvadeMode() { + BossAI::EnterEvadeMode(); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - _EnterEvadeMode(); } void ExecuteEvent(uint32 const eventId) @@ -249,6 +256,10 @@ struct generic_halionAI : public BossAI DoCastVictim(SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000)); break; + case EVENT_TAIL_LASH: + DoCastAOE(SPELL_TAIL_LASH); + events.ScheduleEvent(EVENT_TAIL_LASH, 10000); + break; } } @@ -297,52 +308,54 @@ class boss_halion : public CreatureScript struct boss_halionAI : public generic_halionAI { - boss_halionAI(Creature* creature) : generic_halionAI(creature, DATA_HALION) { } + boss_halionAI(Creature* creature) : generic_halionAI(creature, DATA_HALION) + { + me->SetHomePosition(HalionSpawnPos); + } void Reset() { generic_halionAI::Reset(); me->SetReactState(REACT_DEFENSIVE); - - instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(SPELL_TWILIGHT_PRECISION, me); } void EnterEvadeMode() { // Phase 1: We always can evade. Phase 2 & 3: We can evade if and only if the controller tells us to. - // Controller has absolute priority over the phasemask. if ((events.GetPhaseMask() & PHASE_ONE_MASK) || _canEvade) generic_halionAI::EnterEvadeMode(); } void EnterCombat(Unit* who) { + Talk(SAY_AGGRO); + + events.Reset(); + events.SetPhase(PHASE_ONE); + generic_halionAI::EnterCombat(who); instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); instance->SetBossState(DATA_HALION, IN_PROGRESS); - events.SetPhase(PHASE_ONE); - events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, 10000); + events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, 5000); events.ScheduleEvent(EVENT_FLAME_BREATH, urand(10000, 12000)); events.ScheduleEvent(EVENT_METEOR_STRIKE, urand(20000, 25000)); events.ScheduleEvent(EVENT_FIERY_COMBUSTION, urand(15000, 18000)); - events.ScheduleEvent(EVENT_TAIL_LASH, 10000); if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_ONE); } - void JustDied(Unit* /*killer*/) + void JustDied(Unit* killer) { - _JustDied(); + BossAI::JustDied(killer); Talk(SAY_DEATH); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) me->Kill(controller); @@ -390,21 +403,15 @@ class boss_halion : public CreatureScript switch (eventId) { case EVENT_ACTIVATE_FIREWALL: - { - // Flame ring is activated 10 seconds after starting encounter, DOOR_TYPE_ROOM is only instant. + // Flame ring is activated 5 seconds after starting encounter, DOOR_TYPE_ROOM is only instant. for (uint8 i = DATA_FLAME_RING; i <= DATA_TWILIGHT_FLAME_RING; ++i) if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetData64(i))) instance->HandleGameObject(instance->GetData64(DATA_FLAME_RING), false, flameRing); break; - } case EVENT_FLAME_BREATH: DoCast(me, SPELL_FLAME_BREATH); events.ScheduleEvent(EVENT_FLAME_BREATH, 25000); break; - case EVENT_TAIL_LASH: - DoCastAOE(SPELL_TAIL_LASH); - events.ScheduleEvent(EVENT_TAIL_LASH, 10000); - break; case EVENT_METEOR_STRIKE: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_TWILIGHT_REALM)) @@ -466,29 +473,32 @@ class boss_twilight_halion : public CreatureScript if (!halion) return; - // We use explicit targeting here to avoid conditions + SPELL_ATTR6_CANT_TARGET_SELF. // Using AddAura because no spell cast packet in sniffs. - halion->AddAura(SPELL_COPY_DAMAGE, me); + halion->AddAura(SPELL_COPY_DAMAGE, me); // We use explicit targeting here to avoid conditions + SPELL_ATTR6_CANT_TARGET_SELF. me->AddAura(SPELL_COPY_DAMAGE, halion); + me->AddAura(SPELL_DUSK_SHROUD, me); me->SetHealth(halion->GetHealth()); me->SetPhaseMask(0x20, true); me->SetReactState(REACT_AGGRESSIVE); + } - instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2); - + void EnterCombat(Unit* who) + { events.Reset(); events.SetPhase(PHASE_TWO); + + generic_halionAI::EnterCombat(who); + events.ScheduleEvent(EVENT_DARK_BREATH, urand(10000, 15000)); events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000); - events.ScheduleEvent(EVENT_TAIL_LASH, 10000); - } - void EnterEvadeMode() - { - // We don't care about evading, we will be despawned. + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2); } + // Never evade + void EnterEvadeMode() { } + void KilledUnit(Unit* victim) { if (victim->GetTypeId() == TYPEID_PLAYER) @@ -565,10 +575,6 @@ class boss_twilight_halion : public CreatureScript DoCast(target, SPELL_SOUL_CONSUMPTION); events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000); break; - case EVENT_TAIL_LASH: - DoCastAOE(SPELL_TAIL_LASH); - events.ScheduleEvent(EVENT_TAIL_LASH, 10000); - break; default: generic_halionAI::ExecuteEvent(eventId); break; @@ -1186,10 +1192,19 @@ class npc_living_inferno : public CreatureScript { npc_living_infernoAI(Creature* creature) : ScriptedAI(creature) { } - void JustSummoned(Creature* /*summoner*/) + void IsSummonedBy(Unit* /*summoner*/) { me->SetInCombatWithZone(); - DoCast(me, SPELL_BLAZING_AURA); + me->CastSpell(me, SPELL_BLAZING_AURA, true); + + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + controller->AI()->JustSummoned(me); + } + + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(1); } }; @@ -1220,6 +1235,18 @@ class npc_living_ember : public CreatureScript _hasEnraged = false; } + void IsSummonedBy(Unit* /*summoner*/) + { + if (InstanceScript* instance = me->GetInstanceScript()) + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + controller->AI()->JustSummoned(me); + } + + void JustDied(Unit* /*killer*/) + { + me->DespawnOrUnsummon(1); + } + void UpdateAI(uint32 const diff) { if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING)) diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index a6b50467538..bf48132b2b2 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -45,7 +45,6 @@ class instance_ruby_sanctum : public InstanceMapScript OrbCarrierGUID = 0; OrbRotationFocusGUID = 0; HalionControllerGUID = 0; - CombatStalkerGUID = 0; CrystalChannelTargetGUID = 0; XerestraszaGUID = 0; BaltharusSharedHealth = 0; @@ -56,6 +55,13 @@ class instance_ruby_sanctum : public InstanceMapScript memset(BurningTreeGUID, 0, 4 * sizeof(uint64)); } + void OnPlayerEnter(Player* /*player*/) + { + if (!GetData64(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE) + if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos)) + halionController->AI()->DoAction(ACTION_INTRO_HALION); + } + void OnCreatureCreate(Creature* creature) { switch (creature->GetEntry()) @@ -84,9 +90,6 @@ class instance_ruby_sanctum : public InstanceMapScript case NPC_ORB_ROTATION_FOCUS: OrbRotationFocusGUID = creature->GetGUID(); break; - case NPC_COMBAT_STALKER: - CombatStalkerGUID = creature->GetGUID(); - break; case NPC_BALTHARUS_TARGET: CrystalChannelTargetGUID = creature->GetGUID(); break; @@ -195,8 +198,6 @@ class instance_ruby_sanctum : public InstanceMapScript return FlameRingGUID; case DATA_TWILIGHT_FLAME_RING: return TwilightFlameRingGUID; - case DATA_COMBAT_STALKER: - return CombatStalkerGUID; default: break; } @@ -207,14 +208,7 @@ class instance_ruby_sanctum : public InstanceMapScript bool SetBossState(uint32 type, EncounterState state) { if (!InstanceScript::SetBossState(type, state)) - { - // Summon Halion on instance loading if conditions are met. Without those lines, - // InstanceScript::SetBossState returns false, thus preventing the switch from being called. - if (type == DATA_HALION && state != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE && !GetData64(DATA_HALION_CONTROLLER)) - if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos)) - halionController->AI()->DoAction(ACTION_INTRO_HALION); return false; - } switch (type) { @@ -353,7 +347,6 @@ class instance_ruby_sanctum : public InstanceMapScript uint64 BurningTreeGUID[4]; uint64 FlameRingGUID; uint64 TwilightFlameRingGUID; - uint64 CombatStalkerGUID; uint32 BaltharusSharedHealth; }; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h index 7eb1b73721c..47a55f9035f 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h @@ -52,7 +52,6 @@ enum DataTypes DATA_BURNING_TREE_4 = 16, DATA_FLAME_RING = 17, DATA_TWILIGHT_FLAME_RING = 18, - DATA_COMBAT_STALKER = 19, }; enum SharedActions @@ -97,7 +96,7 @@ enum CreaturesIds NPC_METEOR_STRIKE_FLAME = 40055, NPC_COMBUSTION = 40001, NPC_CONSUMPTION = 40135, - NPC_COMBAT_STALKER = 40151, + NPC_COMBAT_STALKER = 40151, // Seen in sniffs but not used, so no wonder. // Xerestrasza NPC_XERESTRASZA = 40429, diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 28595571a2f..f00369fd9e2 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -32,7 +32,7 @@ #define GOSSIP_ITEM_ETERNOS1 "I want to fly on the wings of the Bronze Flight" #define GOSSIP_ITEM_ETERNOS2 "What abilities do Amber Drakes have?" -#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE, 1) || (a)->HasItemCount(ITEM_AMBER_ESSENCE, 1) || (a)->HasItemCount(ITEM_RUBY_ESSENCE, 1)) +#define HAS_ESSENCE(a) ((a)->HasItemCount(ITEM_EMERALD_ESSENCE) || (a)->HasItemCount(ITEM_AMBER_ESSENCE) || (a)->HasItemCount(ITEM_RUBY_ESSENCE)) enum GossipNPCs { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 67122b2e859..9d8dfa48a68 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -978,7 +978,7 @@ class go_celestial_planetarium_access : public GameObjectScript if (!lock->Index[i]) continue; - if (player->HasItemCount(lock->Index[i], 1)) + if (player->HasItemCount(lock->Index[i])) { hasKey = true; break; diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 976a6e5dba5..1733af17580 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -19,6 +19,8 @@ #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "Vehicle.h" #include "CombatAI.h" @@ -564,6 +566,53 @@ class npc_hyldsmeet_protodrake : public CreatureScript } }; +enum CloseRift +{ + SPELL_DESPAWN_RIFT = 61665 +}; + +class spell_close_rift : public SpellScriptLoader +{ + public: + spell_close_rift() : SpellScriptLoader("spell_close_rift") { } + + class spell_close_rift_AuraScript : public AuraScript + { + PrepareAuraScript(spell_close_rift_AuraScript); + + bool Load() + { + _counter = 0; + return true; + } + + bool Validate(SpellInfo const* /*spell*/) + { + return sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT); + } + + void HandlePeriodic(AuraEffect const* /* aurEff */) + { + if (++_counter == 5) + GetTarget()->CastSpell((Unit*)NULL, SPELL_DESPAWN_RIFT, true); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_close_rift_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + + private: + uint8 _counter; + + }; + + AuraScript* GetAuraScript() const + { + return new spell_close_rift_AuraScript(); + } +}; + void AddSC_storm_peaks() { new npc_agnetta_tyrsdottar(); @@ -574,4 +623,5 @@ void AddSC_storm_peaks() new npc_freed_protodrake(); new npc_icefang(); new npc_hyldsmeet_protodrake(); + new spell_close_rift(); } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index 2aed813550d..d4a3f83ab70 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -559,7 +559,8 @@ public: { if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) if (Player* target = GetExplTargetUnit()->ToPlayer()) - if (target->GetTeamId() != wg->GetDefenderTeam() || target->HasAura(SPELL_WINTERGRASP_TELEPORT_TRIGGER)) + // check if we are in Wintergrasp at all, SotA uses same teleport spells + if ((target->GetZoneId() == 4197) && target->GetTeamId() != wg->GetDefenderTeam() || target->HasAura(SPELL_WINTERGRASP_TELEPORT_TRIGGER)) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; } 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/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 480275c42bd..8533491c15f 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -323,22 +323,22 @@ public: { case 3726: //b'naar if ((player->GetQuestStatus(10299) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10329) == QUEST_STATUS_INCOMPLETE) && - player->HasItemCount(29366, 1)) + player->HasItemCount(29366)) manaforge = player->SummonCreature(ENTRY_BNAAR_C_CONSOLE, 2918.95f, 4189.98f, 161.88f, 0.34f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000); break; case 3730: //coruu if ((player->GetQuestStatus(10321) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10330) == QUEST_STATUS_INCOMPLETE) && - player->HasItemCount(29396, 1)) + player->HasItemCount(29396)) manaforge = player->SummonCreature(ENTRY_CORUU_C_CONSOLE, 2426.77f, 2750.38f, 133.24f, 2.14f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000); break; case 3734: //duro if ((player->GetQuestStatus(10322) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10338) == QUEST_STATUS_INCOMPLETE) && - player->HasItemCount(29397, 1)) + player->HasItemCount(29397)) manaforge = player->SummonCreature(ENTRY_DURO_C_CONSOLE, 2976.48f, 2183.29f, 163.20f, 1.85f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000); break; case 3722: //ara if ((player->GetQuestStatus(10323) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(10365) == QUEST_STATUS_INCOMPLETE) && - player->HasItemCount(29411, 1)) + player->HasItemCount(29411)) manaforge = player->SummonCreature(ENTRY_ARA_C_CONSOLE, 4013.71f, 4028.76f, 192.10f, 1.25f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 125000); break; } @@ -704,7 +704,7 @@ public: if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if (player->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(29778, 1)) + if (player->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !player->HasItemCount(29778)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp index aa51b532c27..a48866a2f83 100644 --- a/src/server/scripts/Outland/zangarmarsh.cpp +++ b/src/server/scripts/Outland/zangarmarsh.cpp @@ -249,7 +249,7 @@ public: break; case GOSSIP_ACTION_INFO_DEF + 2: { - if (!player->HasItemCount(24573, 1)) + if (!player->HasItemCount(24573)) { ItemPosCountVec dest; uint32 itemId = 24573; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 547cb3dba51..519d79add6d 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1581,12 +1581,12 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader } - LFGDungeonEntry const* randomDungeon = sLFGMgr->GetLFGDungeon(*itr); + LFGDungeonData const* randomDungeon = sLFGMgr->GetLFGDungeon(*itr); if (Group* group = owner->GetGroup()) if (Map const* map = owner->GetMap()) if (group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) - if (LFGDungeonEntry const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) + if (LFGDungeonData const* dungeon = sLFGMgr->GetLFGDungeon(dungeonId)) if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) return; // in correct dungeon 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()); } }; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 2a5d58122ed..ddb0044a888 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -677,28 +677,28 @@ public: switch (go->GetEntry()) { case MATRIX_PUNCHOGRAPH_3005_A: - if (player->HasItemCount(ITEM_WHITE_PUNCH_CARD, 1)) + if (player->HasItemCount(ITEM_WHITE_PUNCH_CARD)) { player->DestroyItemCount(ITEM_WHITE_PUNCH_CARD, 1, true); player->CastSpell(player, SPELL_YELLOW_PUNCH_CARD, true); } break; case MATRIX_PUNCHOGRAPH_3005_B: - if (player->HasItemCount(ITEM_YELLOW_PUNCH_CARD, 1)) + if (player->HasItemCount(ITEM_YELLOW_PUNCH_CARD)) { player->DestroyItemCount(ITEM_YELLOW_PUNCH_CARD, 1, true); player->CastSpell(player, SPELL_BLUE_PUNCH_CARD, true); } break; case MATRIX_PUNCHOGRAPH_3005_C: - if (player->HasItemCount(ITEM_BLUE_PUNCH_CARD, 1)) + if (player->HasItemCount(ITEM_BLUE_PUNCH_CARD)) { player->DestroyItemCount(ITEM_BLUE_PUNCH_CARD, 1, true); player->CastSpell(player, SPELL_RED_PUNCH_CARD, true); } break; case MATRIX_PUNCHOGRAPH_3005_D: - if (player->HasItemCount(ITEM_RED_PUNCH_CARD, 1)) + if (player->HasItemCount(ITEM_RED_PUNCH_CARD)) { player->DestroyItemCount(ITEM_RED_PUNCH_CARD, 1, true); player->CastSpell(player, SPELL_PRISMATIC_PUNCH_CARD, true); @@ -884,7 +884,7 @@ public: bool OnGossipHello(Player* player, GameObject* /*go*/) { - if (player->HasItemCount(ITEM_CUERGOS_KEY, 1)) + if (player->HasItemCount(ITEM_CUERGOS_KEY)) return false; player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true); @@ -910,7 +910,7 @@ public: bool OnGossipHello(Player* player, GameObject* go) { - if (!player->HasItemCount(ITEM_TELEPORTER_POWER_PACK, 1)) + if (!player->HasItemCount(ITEM_TELEPORTER_POWER_PACK)) return false; go->SummonCreature(NPC_IMAGE_WIND_TRADER, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); @@ -998,7 +998,7 @@ class go_soulwell : public GameObjectScript return true; // Don't try to add a stone if we already have one. - if (player->HasItemCount(_stoneId, 1)) + if (player->HasItemCount(_stoneId)) { if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_stoneSpell)) Spell::SendCastResult(player, spell, 0, SPELL_FAILED_TOO_MANY_OF_ITEM); @@ -1007,7 +1007,7 @@ class go_soulwell : public GameObjectScript owner->CastSpell(player, _stoneSpell, true); // Item has to actually be created to remove a charge on the well. - if (player->HasItemCount(_stoneId, 1)) + if (player->HasItemCount(_stoneId)) go->AddUse(); return false; @@ -1158,7 +1158,7 @@ public: go->CastSpell(target, SPELL_INDISPOSED_III); } go->CastSpell(player, SPELL_INDISPOSED); - if (player->HasItemCount(ITEM_ANDERHOLS_SLIDER_CIDER, 1)) + if (player->HasItemCount(ITEM_ANDERHOLS_SLIDER_CIDER)) go->CastSpell(player, SPELL_CREATE_AMBERSEEDS); return true; } diff --git a/src/server/scripts/World/npc_taxi.cpp b/src/server/scripts/World/npc_taxi.cpp index 6241978fbd2..efdd4da73d6 100644 --- a/src/server/scripts/World/npc_taxi.cpp +++ b/src/server/scripts/World/npc_taxi.cpp @@ -77,7 +77,7 @@ public: player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SUSURRUS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); break; case 20903: // Netherstorm - Protectorate Nether Drake - if (player->GetQuestStatus(10438) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(29778, 1)) + if (player->GetQuestStatus(10438) == QUEST_STATUS_INCOMPLETE && player->HasItemCount(29778)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NETHER_DRAKE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); break; case 18725: // Old Hillsbrad Foothills - Brazen @@ -203,7 +203,7 @@ public: player->ActivateTaxiPathTo(627); //TaxiPath 627 (possibly 627+628(152->153->154->155)) break; case GOSSIP_ACTION_INFO_DEF + 2: - if (!player->HasItemCount(25853, 1)) + if (!player->HasItemCount(25853)) player->SEND_GOSSIP_MENU(9780, creature->GetGUID()); else { diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index b291b9751b4..4f0687ef11d 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1268,7 +1268,7 @@ public: if (player->GetSpecsCount() == 1 && creature->isCanTrainingAndResetTalentsOf(player) && player->getLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL)) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE3, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_LEARNDUALSPEC); - if (player->getClass() == CLASS_ROGUE && player->getLevel() >= 24 && !player->HasItemCount(17126, 1) && !player->GetQuestRewardStatus(6681)) + if (player->getClass() == CLASS_ROGUE && player->getLevel() >= 24 && !player->HasItemCount(17126) && !player->GetQuestRewardStatus(6681)) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(5996, creature->GetGUID()); diff --git a/src/server/shared/Logging/Appender.h b/src/server/shared/Logging/Appender.h index 5c4b009ef67..2d6145b14af 100644 --- a/src/server/shared/Logging/Appender.h +++ b/src/server/shared/Logging/Appender.h @@ -25,48 +25,48 @@ enum LogFilterType { - LOG_FILTER_GENERAL, // This one should only be used inside Log.cpp - LOG_FILTER_UNITS, // Anything related to units that doesn't fit in other categories. ie. creature formations - LOG_FILTER_PETS, - LOG_FILTER_VEHICLES, - LOG_FILTER_TSCR, // C++ AI, instance scripts, etc. - LOG_FILTER_DATABASE_AI, // SmartAI, EventAI, Creature* * AI - LOG_FILTER_MAPSCRIPTS, - LOG_FILTER_NETWORKIO, - LOG_FILTER_SPELLS_AURAS, - LOG_FILTER_ACHIEVEMENTSYS, - LOG_FILTER_CONDITIONSYS, - LOG_FILTER_POOLSYS, - LOG_FILTER_AUCTIONHOUSE, - LOG_FILTER_BATTLEGROUND, - LOG_FILTER_OUTDOORPVP, - LOG_FILTER_CHATSYS, - LOG_FILTER_LFG, - LOG_FILTER_MAPS, - LOG_FILTER_PLAYER, // Any player log that does not fit in other player filters - LOG_FILTER_PLAYER_LOADING, // Debug output from Player::_Load functions - LOG_FILTER_PLAYER_ITEMS, - LOG_FILTER_PLAYER_SKILLS, - LOG_FILTER_PLAYER_CHATLOG, - LOG_FILTER_LOOT, - LOG_FILTER_GUILD, - LOG_FILTER_TRANSPORTS, - LOG_FILTER_SQL, - LOG_FILTER_GMCOMMAND, - LOG_FILTER_REMOTECOMMAND, - LOG_FILTER_WARDEN, - LOG_FILTER_AUTHSERVER, - LOG_FILTER_WORLDSERVER, - LOG_FILTER_GAMEEVENTS, - LOG_FILTER_CALENDAR, - LOG_FILTER_CHARACTER, - LOG_FILTER_ARENAS, - LOG_FILTER_SQL_DRIVER, - LOG_FILTER_SQL_DEV, - LOG_FILTER_PLAYER_DUMP, - LOG_FILTER_BATTLEFIELD, - LOG_FILTER_SERVER_LOADING, - LOG_FILTER_OPCODES + LOG_FILTER_GENERAL = 0, // This one should only be used inside Log.cpp + LOG_FILTER_UNITS = 1, // Anything related to units that doesn't fit in other categories. ie. creature formations + LOG_FILTER_PETS = 2, + LOG_FILTER_VEHICLES = 3, + LOG_FILTER_TSCR = 4, // C++ AI, instance scripts, etc. + LOG_FILTER_DATABASE_AI = 5, // SmartAI, EventAI, Creature* * AI + LOG_FILTER_MAPSCRIPTS = 6, + LOG_FILTER_NETWORKIO = 7, + LOG_FILTER_SPELLS_AURAS = 8, + LOG_FILTER_ACHIEVEMENTSYS = 9, + LOG_FILTER_CONDITIONSYS = 10, + LOG_FILTER_POOLSYS = 11, + LOG_FILTER_AUCTIONHOUSE = 12, + LOG_FILTER_BATTLEGROUND = 13, + LOG_FILTER_OUTDOORPVP = 14, + LOG_FILTER_CHATSYS = 15, + LOG_FILTER_LFG = 16, + LOG_FILTER_MAPS = 17, + LOG_FILTER_PLAYER = 18, // Any player log that does not fit in other player filters + LOG_FILTER_PLAYER_LOADING = 19, // Debug output from Player::_Load functions + LOG_FILTER_PLAYER_ITEMS = 20, + LOG_FILTER_PLAYER_SKILLS = 21, + LOG_FILTER_PLAYER_CHATLOG = 22, + LOG_FILTER_LOOT = 23, + LOG_FILTER_GUILD = 24, + LOG_FILTER_TRANSPORTS = 25, + LOG_FILTER_SQL = 26, + LOG_FILTER_GMCOMMAND = 27, + LOG_FILTER_REMOTECOMMAND = 28, + LOG_FILTER_WARDEN = 29, + LOG_FILTER_AUTHSERVER = 30, + LOG_FILTER_WORLDSERVER = 31, + LOG_FILTER_GAMEEVENTS = 32, + LOG_FILTER_CALENDAR = 33, + LOG_FILTER_CHARACTER = 34, + LOG_FILTER_ARENAS = 35, + LOG_FILTER_SQL_DRIVER = 36, + LOG_FILTER_SQL_DEV = 37, + LOG_FILTER_PLAYER_DUMP = 38, + LOG_FILTER_BATTLEFIELD = 39, + LOG_FILTER_SERVER_LOADING = 40, + LOG_FILTER_OPCODES = 41 }; const uint8 MaxLogFilter = uint8(LOG_FILTER_OPCODES) + 1; @@ -95,12 +95,12 @@ enum AppenderType enum AppenderFlags { - APPENDER_FLAGS_NONE = 0x00, - APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01, - APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02, - APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04, - APPENDER_FLAGS_USE_TIMESTAMP = 0x08, // only used by FileAppender - APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10 // only used by FileAppender + APPENDER_FLAGS_NONE = 0x00, + APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01, + APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02, + APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04, + APPENDER_FLAGS_USE_TIMESTAMP = 0x08, // only used by FileAppender + APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10 // only used by FileAppender }; struct LogMessage diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 4538fc75c1e..d8914ac8ee0 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -435,10 +435,10 @@ void Log::outCharDump(char const* str, uint32 accountId, uint32 guid, char const << ")\n" << str << "\n== END DUMP ==\n"; LogMessage* msg = new LogMessage(LOG_LEVEL_INFO, LOG_FILTER_PLAYER_DUMP, ss.str()); - ss.clear(); - ss << guid << '_' << name; + std::ostringstream param; + param << guid << '_' << name; - msg->param1 = ss.str(); + msg->param1 = param.str(); write(msg); } diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 7e43cf87dfc..16fbca2597d 100755 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -104,13 +104,13 @@ extern int main(int argc, char **argv) if (strcmp(argv[c], "install") == 0) { if (WinServiceInstall()) - printf("Installing service"); + printf("Installing service\n"); return 1; } else if (strcmp(argv[c], "uninstall") == 0) { if (WinServiceUninstall()) - printf("Uninstalling service"); + printf("Uninstalling service\n"); return 1; } else @@ -131,8 +131,8 @@ extern int main(int argc, char **argv) if (!ConfigMgr::Load(cfg_file)) { - printf("Invalid or missing configuration file : %s", cfg_file); - printf("Verify that the file exists and has \'[worldserver]' written in the top of the file!"); + printf("Invalid or missing configuration file : %s\n", cfg_file); + printf("Verify that the file exists and has \'[worldserver]' written in the top of the file!\n"); return 1; } sLog->outInfo(LOG_FILTER_WORLDSERVER, "Using configuration file %s.", cfg_file); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 55443f4253b..8f79cff8f46 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1106,12 +1106,15 @@ Command.LookupMaxResults = 0 AllowTickets = 1 # -# DungeonFinder.Enable +# DungeonFinder.OptionsMask # Description: Dungeon and raid finder system. -# Default: 1 - (Enabled) -# 0 - (Disabled) +# Value is a bitmask consisting of: +# LFG_OPTION_ENABLE_DUNGEON_FINDER = 1, Enable the dungeon finder browser +# LFG_OPTION_ENABLE_RAID_BROWSER = 2, Enable the raid browser +# Default: 1 + +DungeonFinder.OptionsMask = 1 -DungeonFinder.Enable = 1 # # DBC.EnforceItemAttributes |