diff options
41 files changed, 469 insertions, 277 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 72d1a225f28..b5db167fa22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,8 @@ include(CheckPlatform) find_package(PCHSupport) find_package(ACE REQUIRED) find_package(OpenSSL REQUIRED) +find_package(Threads REQUIRED) + if( NOT USE_MYSQL_SOURCES ) find_package(MySQL REQUIRED) endif() diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index 2730d9071fa..f303b6ed761 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -52,7 +52,7 @@ if(NOT WITH_WARNINGS) endif() # Specify the maximum PreCompiled Header memory allocation limit -# Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid disrupancies) +# Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid discrepancies) # (And yes, this is a verified , unresolved bug with MSVC... *sigh*) string(REGEX REPLACE "/Zm[0-9]+ *" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500" CACHE STRING "" FORCE) diff --git a/sql/updates/world/2013_05_19_00_world_trinity_strings.sql b/sql/updates/world/2013_05_19_00_world_trinity_strings.sql new file mode 100644 index 00000000000..efdffb68b59 --- /dev/null +++ b/sql/updates/world/2013_05_19_00_world_trinity_strings.sql @@ -0,0 +1,24 @@ +DELETE FROM `trinity_string` WHERE entry IN (453, 548, 549, 550, 714, 716, 749, 752, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856); +INSERT INTO `trinity_string` (entry, content_default) VALUES +(453,'│Player %s %s (guid: %u)'), +(548,'│ GM Mode active, Phase: -1'), +(549,'├─ Banned: (Type: %s, Reason: %s, Time: %s, By: %s)'), +(550,'├─ Muted: (Reason: %s, Time: %s, By: %s)'), +(714,'│ Account: %s (ID: %u), GMLevel: %u'), +(716,'│ Last Login: %s (Failed Logins: %u)'), +(749,'│ OS: %s - Latency: %u ms - Mail: %s'), +(752,'│ Last IP: %s (Locked: %s)'), +(843,'│ Level: %u (%u/%u XP (%u XP left))'), +(844,'│ Race: %s %s, %s'), +(845,'│ Alive ?: %s'), +(846,'│ Phase: %u'), +(847,'│ Money: %ug%us%uc'), +(848,'│ Map: %s, Area: %s, Zone: %s'), +(849,'│ Guild: %s (ID: %u)'), +(850,'├─ Rank: %s'), +(851,'├─ Note: %s'), +(852,'├─ O. Note: %s'), +(853,'│ Played time: %s'), +(854,'└ Mails: %d Read/%I64u Total'), +(855,'Male'), +(856,'Female'); diff --git a/sql/updates/world/2013_05_20_00_world_creature_addon.sql b/sql/updates/world/2013_05_20_00_world_creature_addon.sql new file mode 100644 index 00000000000..5ba69949241 --- /dev/null +++ b/sql/updates/world/2013_05_20_00_world_creature_addon.sql @@ -0,0 +1 @@ +DELETE FROM `creature_addon` WHERE `guid`=136437; diff --git a/sql/updates/world/2013_05_20_01_world_misc.sql b/sql/updates/world/2013_05_20_01_world_misc.sql new file mode 100644 index 00000000000..55eda1e80a5 --- /dev/null +++ b/sql/updates/world/2013_05_20_01_world_misc.sql @@ -0,0 +1,35 @@ +-- Prevent multiple template installation tries +UPDATE `smart_scripts` SET `event_type`=37 WHERE `entryorguid` IN (474,881,26257) AND `source_type`=0 AND `id`=0; +UPDATE `smart_scripts` SET `event_type`=37 WHERE `entryorguid` IN (18716,18719) AND `source_type`=0 AND `id`=1; + +-- Remove not existing event links +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid`=61 AND `id`=0 AND `source_type`=1; +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid`=3594 AND `id`=0 AND `source_type`=0; +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid`=1399 AND `id`=3 AND `source_type`=0; +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid`=305400 AND `id`=0 AND `source_type`=9; + +-- Convert EAI to SAI and add conditions to prevent multiple SMART_ACTION_UPDATE_TEMPLATE calls +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=20778; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=20778; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=20778 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`id`,`event_type`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`target_type`,`comment`) VALUES +(20778,0,0,2000,6000,7000,10000,11,36519,32,5,'Void Waste - Cast Toxic Burst'), +(20778,1,8,35686,0,0,0,36,20805,0,1,'Void Waste - Change Entry after (proc) Spell 35686'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceGroup`=2 AND `SourceEntry`=20778 AND `SourceId`=0; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ConditionTarget`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`NegativeCondition`,`Comment`) VALUE +(22,2,20778,0,1,31,3,20805,1,'Void Waste may not already be transformed to template entry 20805 when trying to update template to 20805'); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=20501; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=20501; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=20501 AND `source_type`=0; +INSERT INTO `smart_scripts`(`entryorguid`,`id`,`event_type`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`target_type`,`comment`) VALUES +(20501,0,2,0,50,30000,45000,11,36465,0,1,'Seeping Sludge - Cast Seeping Split at 50% HP'), +(20501,1,8,35686,0,0,0,36,20806,0,1,'Seeping Sludge - Change Entry after (proc) Spell 35686'), +(20501,2,11,0,0,0,0,11,35242,0,1,'Seeping Sludge - Darkstalker Birth'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceGroup`=2 AND `SourceEntry`=20501 AND `SourceId`=0; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ConditionTarget`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`NegativeCondition`,`Comment`) VALUE +(22,2,20501,0,1,31,3,20805,1,'Seeping Sludge may not already be transformed to template entry 20806 when trying to update template to 20806'); diff --git a/sql/updates/world/2013_05_20_02_world_areatrigger_teleport.sql b/sql/updates/world/2013_05_20_02_world_areatrigger_teleport.sql new file mode 100644 index 00000000000..4b6220161bd --- /dev/null +++ b/sql/updates/world/2013_05_20_02_world_areatrigger_teleport.sql @@ -0,0 +1,5 @@ +DELETE FROM `areatrigger_teleport` WHERE `id` IN (2547, 2548, 2549); +INSERT INTO `areatrigger_teleport` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`, `name`) VALUES +(2547, 0, 1399.42, -2574.59, 107.786, 6.28319, 'Scholomance - Exit Porch Target 001'), +(2548, 0, 1399.42, -2574.59, 107.786, 6.28319, 'Scholomance - Exit Porch Target 001'), +(2549, 0, 1399.42, -2574.59, 107.786, 6.28319, 'Scholomance - Exit Porch Target 001'); diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index 57ab1ffa4ed..6d756434a20 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -80,6 +80,8 @@ target_link_libraries(authserver shared ${MYSQL_LIBRARY} ${OPENSSL_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${ACE_LIBRARY} ) if( WIN32 ) diff --git a/src/server/collision/Management/MMapFactory.cpp b/src/server/collision/Management/MMapFactory.cpp index 7adf7fbfa66..6aa71d77ed8 100644 --- a/src/server/collision/Management/MMapFactory.cpp +++ b/src/server/collision/Management/MMapFactory.cpp @@ -25,7 +25,7 @@ namespace MMAP { // ######################## MMapFactory ######################## // our global singleton copy - MMapManager *g_MMapManager = NULL; + MMapManager* g_MMapManager = NULL; MMapManager* MMapFactory::createOrGetMMapManager() { diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp index ac0a935dd39..a3f89f42443 100644 --- a/src/server/collision/Management/MMapManager.cpp +++ b/src/server/collision/Management/MMapManager.cpp @@ -109,7 +109,7 @@ namespace MMAP snprintf(fileName, pathLen, (sWorld->GetDataPath()+"mmaps/%03i%02i%02i.mmtile").c_str(), mapId, x, y); - FILE *file = fopen(fileName, "rb"); + FILE* file = fopen(fileName, "rb"); if (!file) { TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:loadMap: Could not open mmtile file '%s'", fileName); @@ -156,7 +156,7 @@ namespace MMAP { mmap->mmapLoadedTiles.insert(std::pair<uint32, dtTileRef>(packedGridPos, tileRef)); ++loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:loadMap: Loaded mmtile %03i[%02i,%02i] into %03i[%02i,%02i]", mapId, x, y, mapId, header->x, header->y); + TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:loadMap: Loaded mmtile %03i[%02i, %02i] into %03i[%02i, %02i]", mapId, x, y, mapId, header->x, header->y); return true; } else @@ -205,7 +205,7 @@ namespace MMAP { mmap->mmapLoadedTiles.erase(packedGridPos); --loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId); + TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i, %02i] from %03i", mapId, x, y, mapId); return true; } @@ -232,7 +232,7 @@ namespace MMAP else { --loadedTiles; - TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId); + TC_LOG_INFO(LOG_FILTER_MAPS, "MMAP:unloadMap: Unloaded mmtile %03i[%02i, %02i] from %03i", mapId, x, y, mapId); } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 7a0af0b06d7..bbe3b064c35 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1046,7 +1046,7 @@ const uint32 BG_AV_CreatureInfo[AV_NPC_INFO_MAX][4] = { 13326, 1216, 59, 59 }, //Seasoned Defender { 13331, 1216, 60, 60 }, //Veteran Defender { 13422, 1216, 61, 61 }, //Champion Defender - { 13358, 1216, 59, 60 }, //Stormpike Bowman /// @todo: Confirm if this is correct. Author assumpted 60,61 & 69,70, but wouldn't work here + { 13358, 1216, 59, 60 }, //Stormpike Bowman /// @todo: Confirm if this is correct. Author assumpted 60, 61 & 69, 70, but wouldn't work here { 11949, 469, 0, 0}, //not spawned with this data, but used for handlekillunit { 11948, 469, 0, 0}, //not spawned with this data, but used for handlekillunit { 12053, 1214, 58, 58 }, //Frostwolf Guardian diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index fd5183753e1..d3c2a16c592 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -418,7 +418,7 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] The prospective passenger. + * @param [in, out] The prospective passenger. * @param seatId Identifier for the seat. Value of -1 indicates the next available seat. * * @return true if it succeeds, false if it fails. @@ -493,7 +493,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] unit The passenger to remove. + * @param [in, out] unit The passenger to remove. */ void Vehicle::RemovePassenger(Unit* unit) @@ -616,7 +616,7 @@ void Vehicle::InitMovementInfoForBase() * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] The passenger for which we check the seat info. + * @param [in, out] The passenger for which we check the seat info. * * @return null if passenger not found on vehicle, else the DBC record for the seat. */ @@ -638,7 +638,7 @@ VehicleSeatEntry const* Vehicle::GetSeatForPassenger(Unit const* passenger) cons * @author Machiavelli * @date 17-2-2013 * - * @param [in,out] passenger Passenger to look up. + * @param [in, out] passenger Passenger to look up. * * @return The seat iterator for specified passenger if it's found on the vehicle. Otherwise Seats.end() (invalid iterator). */ diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 68f00a28cf1..9d4eae0f1b0 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -289,7 +289,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) // If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to // We also do that if a player is under the required level for whispers. - if (receiver->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ) || + if (receiver->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_WHISPER_LEVEL_REQ) || (HasPermission(RBAC_PERM_CAN_FILTER_WHISPERS) && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID()))) sender->AddWhisperWhiteList(receiver->GetGUID()); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index f75c96c0898..6527c0740ad 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -259,10 +259,10 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) Item* item = items[i]; if (log) { - sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) " - "to player: %s (Account: %u)", GetPlayerName().c_str(), GetAccountId(), + sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail item: %s (Entry: %u Count: %u) " + "to player: %s (GUID: %u) (Account: %u)", GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), - receiverName.c_str(), receiverAccountId); + receiverName.c_str(), receiverGuid, receiverAccountId); } item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable @@ -281,8 +281,8 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) if (log && money > 0) { - sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)", - GetPlayerName().c_str(), GetAccountId(), money, receiverName.c_str(), receiverAccountId); + sLog->outCommand(GetAccountId(), "GM %s (GUID: %u) (Account: %u) mail money: %u to player: %s (GUID: %u) (Account: %u)", + GetPlayerName().c_str(), GetGuidLow(), GetAccountId(), money, receiverName.c_str(), receiverGuid, receiverAccountId); } } diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index e04e9208a05..3bb663f2978 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -444,7 +444,7 @@ enum TrinityStrings LANG_COMMAND_GRAVEYARDALRLINKED = 450, LANG_COMMAND_GRAVEYARDLINKED = 451, LANG_COMMAND_GRAVEYARDWRONGZONE = 452, - // = 453, see LANG_PINFO_BAN + // = 453, see LANG_PINFO_PLAYER LANG_COMMAND_GRAVEYARDERROR = 454, LANG_COMMAND_GRAVEYARD_NOTEAM = 455, LANG_COMMAND_GRAVEYARD_ANY = 456, @@ -555,13 +555,9 @@ enum TrinityStrings LANG_NPCINFO_TRAINER = 546, LANG_NPCINFO_DUNGEON_ID = 547, - LANG_PINFO_ACCOUNT = 548, - LANG_PINFO_LEVEL = 549, - LANG_PINFO_MUTE = 550, - LANG_PINFO_BAN = 453, - LANG_PINFO_MAP_ONLINE = 714, - LANG_PINFO_MAP_OFFLINE = 716, - LANG_PINFO_GUILD_INFO = 749, + // = 548, see LANG_PINFO_GM_ACTIVE + // = 549, see LANG_PINFO_BANNED + // = 550, see LANG_PINFO_MUTED LANG_YOU_SET_EXPLORE_ALL = 551, LANG_YOU_SET_EXPLORE_NOTHING = 552, @@ -709,9 +705,9 @@ enum TrinityStrings LANG_BG_QUEUE_ANNOUNCE_SELF = 711, LANG_BG_QUEUE_ANNOUNCE_WORLD = 712, LANG_YOUR_ARENA_LEVEL_REQ_ERROR = 713, -// = 714, see LANG_PINFO_MAP_ONLINE +// = 714, see LANG_PINFO_ACC_ACCOUNT LANG_YOUR_BG_LEVEL_REQ_ERROR = 715, -// = 716, see LANG_PINFO_MAP_OFFLINE +// = 716, see LANG_PINFO_ACC_LASTLOGIN LANG_BG_STARTED_ANNOUNCE_WORLD = 717, LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN= 718, LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT= 719, @@ -746,10 +742,10 @@ enum TrinityStrings LANG_DIST_ARENA_POINTS_END = 746, LANG_BG_DISABLED = 747, LANG_ARENA_DISABLED = 748, -// = 749, not used +// = 749, see LANG_PINFO_ACC_OS LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING = 750, // "Not enough players. This game will close in %u mins." LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS = 751, // "Not enough players. This game will close in %u seconds." -// = 752, not used +// = 752, see LANG_PINFO_ACC_IP // LANG_BG_WS_START_TWO_MINUTES = 753, - defined above // LANG_BG_AB_START_TWO_MINUTES = 754, - defined above // LANG_BG_EY_START_TWO_MINUTES = 755, - defined above @@ -807,7 +803,32 @@ enum TrinityStrings LANG_NPCINFO_MAILBOX = 841, LANG_NPCINFO_PLAYER_VEHICLE = 842, - // Room for in-game strings 843-999 not used + // Pinfo commands + LANG_PINFO_PLAYER = 453, + LANG_PINFO_GM_ACTIVE = 548, + LANG_PINFO_BANNED = 549, + LANG_PINFO_MUTED = 550, + LANG_PINFO_ACC_ACCOUNT = 714, + LANG_PINFO_ACC_LASTLOGIN = 716, + LANG_PINFO_ACC_OS = 749, + LANG_PINFO_ACC_IP = 752, + LANG_PINFO_CHR_LEVEL = 843, + LANG_PINFO_CHR_RACE = 844, + LANG_PINFO_CHR_ALIVE = 845, + LANG_PINFO_CHR_PHASE = 846, + LANG_PINFO_CHR_MONEY = 847, + LANG_PINFO_CHR_MAP = 848, + LANG_PINFO_CHR_GUILD = 849, + LANG_PINFO_CHR_GUILD_RANK = 850, + LANG_PINFO_CHR_GUILD_NOTE = 851, + LANG_PINFO_CHR_GUILD_ONOTE = 852, + LANG_PINFO_CHR_PLAYEDTIME = 853, + LANG_PINFO_CHR_MAILS = 854, + + LANG_CHARACTER_GENDER_MALE = 855, + LANG_CHARACTER_GENDER_FEMALE = 856, + + // Room for in-game strings 857-999 not used // Level 4 (CLI only commands) LANG_COMMAND_EXIT = 1000, diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index abb4ac9964b..8086e60c912 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -27,7 +27,7 @@ #include "Player.h" template<class T, typename D> -void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool updateDestination) +void TargetedMovementGeneratorMedium<T, D>::_setTargetLocation(T* owner, bool updateDestination) { if (!i_target.isValid() || !i_target->IsInWorld()) return; @@ -117,7 +117,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool upd } template<class T, typename D> -bool TargetedMovementGeneratorMedium<T,D>::DoUpdate(T* owner, uint32 time_diff) +bool TargetedMovementGeneratorMedium<T, D>::DoUpdate(T* owner, uint32 time_diff) { if (!i_target.isValid() || !i_target->IsInWorld()) return false; @@ -185,7 +185,7 @@ template<class T> void ChaseMovementGenerator<T>::_reachTarget(T* owner) { if (owner->IsWithinMeleeRange(this->i_target.getTarget())) - owner->Attack(this->i_target.getTarget(),true); + owner->Attack(this->i_target.getTarget(), true); } template<> @@ -303,14 +303,14 @@ void FollowMovementGenerator<Creature>::MovementInform(Creature* unit) } //-----------------------------------------------// -template void TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Player> >::_setTargetLocation(Player*, bool); -template void TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::_setTargetLocation(Player*, bool); -template void TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::_setTargetLocation(Creature*, bool); -template void TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::_setTargetLocation(Creature*, bool); -template bool TargetedMovementGeneratorMedium<Player,ChaseMovementGenerator<Player> >::DoUpdate(Player*, uint32); -template bool TargetedMovementGeneratorMedium<Player,FollowMovementGenerator<Player> >::DoUpdate(Player*, uint32); -template bool TargetedMovementGeneratorMedium<Creature,ChaseMovementGenerator<Creature> >::DoUpdate(Creature*, uint32); -template bool TargetedMovementGeneratorMedium<Creature,FollowMovementGenerator<Creature> >::DoUpdate(Creature*, uint32); +template void TargetedMovementGeneratorMedium<Player, ChaseMovementGenerator<Player> >::_setTargetLocation(Player*, bool); +template void TargetedMovementGeneratorMedium<Player, FollowMovementGenerator<Player> >::_setTargetLocation(Player*, bool); +template void TargetedMovementGeneratorMedium<Creature, ChaseMovementGenerator<Creature> >::_setTargetLocation(Creature*, bool); +template void TargetedMovementGeneratorMedium<Creature, FollowMovementGenerator<Creature> >::_setTargetLocation(Creature*, bool); +template bool TargetedMovementGeneratorMedium<Player, ChaseMovementGenerator<Player> >::DoUpdate(Player*, uint32); +template bool TargetedMovementGeneratorMedium<Player, FollowMovementGenerator<Player> >::DoUpdate(Player*, uint32); +template bool TargetedMovementGeneratorMedium<Creature, ChaseMovementGenerator<Creature> >::DoUpdate(Creature*, uint32); +template bool TargetedMovementGeneratorMedium<Creature, FollowMovementGenerator<Creature> >::DoUpdate(Creature*, uint32); template void ChaseMovementGenerator<Player>::_reachTarget(Player*); template void ChaseMovementGenerator<Creature>::_reachTarget(Creature*); diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 80e8f1e1f44..3fd7e7ee393 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -701,7 +701,7 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo // Find movement delta. float delta[VERTEX_SIZE]; dtVsub(delta, steerPos, iterPos); - float len = dtSqrt(dtVdot(delta,delta)); + float len = dtSqrt(dtVdot(delta, delta)); // If the steer target is end of path or off-mesh link, do not move past the location. if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE) len = 1.0f; diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index 4b1af78a799..49a33a4f79e 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -118,7 +118,7 @@ namespace Movement } PacketBuilder::WriteMonsterMove(move_spline, data); - unit->SendMessageToSet(&data,true); + unit->SendMessageToSet(&data, true); return move_spline.Duration(); } diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index 2a2f3fa8f43..42090cae71b 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -91,13 +91,13 @@ public: @param t - percent of segment length, assumes that t in range [0, 1] @param Idx - spline segment index, should be in range [first, last) */ - void evaluate_percent(index_type Idx, float u, Vector3& c) const {(this->*evaluators[m_mode])(Idx, u,c);} + void evaluate_percent(index_type Idx, float u, Vector3& c) const {(this->*evaluators[m_mode])(Idx, u, c);} /** Caclulates derivation in index Idx, and percent of segment length t @param Idx - spline segment index, should be in range [first, last) @param t - percent of spline segment length, assumes that t in range [0, 1] */ - void evaluate_derivative(index_type Idx, float u, Vector3& hermite) const {(this->*derivative_evaluators[m_mode])(Idx, u,hermite);} + void evaluate_derivative(index_type Idx, float u, Vector3& hermite) const {(this->*derivative_evaluators[m_mode])(Idx, u, hermite);} /** Bounds for spline indexes. All indexes should be in range [first, last). */ index_type first() const { return index_lo;} @@ -156,12 +156,12 @@ public: /** Calculates the position for given segment Idx, and percent of segment length t @param t = partial_segment_length / whole_segment_length @param Idx - spline segment index, should be in range [first, last). */ - void evaluate_percent(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_percent(Idx, u,c);} + void evaluate_percent(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_percent(Idx, u, c);} /** Caclulates derivation for index Idx, and percent of segment length t @param Idx - spline segment index, should be in range [first, last) @param t - percent of spline segment length, assumes that t in range [0, 1]. */ - void evaluate_derivative(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_derivative(Idx, u,c);} + void evaluate_derivative(index_type Idx, float u, Vector3& c) const { SplineBase::evaluate_derivative(Idx, u, c);} // Assumes that t in range [0, 1] index_type computeIndexInBounds(float t) const; @@ -169,7 +169,7 @@ public: /** Initializes spline. Don't call other methods while spline not initialized. */ void init_spline(const Vector3 * controls, index_type count, EvaluationMode m) { SplineBase::init_spline(controls, count, m);} - void init_cyclic_spline(const Vector3 * controls, index_type count, EvaluationMode m, index_type cyclic_point) { SplineBase::init_cyclic_spline(controls, count, m,cyclic_point);} + void init_cyclic_spline(const Vector3 * controls, index_type count, EvaluationMode m, index_type cyclic_point) { SplineBase::init_cyclic_spline(controls, count, m, cyclic_point);} /** Initializes lengths with SplineBase::SegLength method. */ void initLengths(); diff --git a/src/server/game/Movement/Waypoints/Path.h b/src/server/game/Movement/Waypoints/Path.h index 39f05184cf6..9814d1c65e1 100644 --- a/src/server/game/Movement/Waypoints/Path.h +++ b/src/server/game/Movement/Waypoints/Path.h @@ -40,13 +40,13 @@ class Path void erase(uint32 idx) { i_nodes.erase(i_nodes.begin()+idx); } void crop(unsigned int start, unsigned int end) { - while(start && !i_nodes.empty()) + while (start && !i_nodes.empty()) { i_nodes.pop_front(); --start; } - while(end && !i_nodes.empty()) + while (end && !i_nodes.empty()) { i_nodes.pop_back(); --end; diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index fdcf88177a9..e51052bc18f 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -320,7 +320,7 @@ public: // check online security if (handler->HasLowerSecurity(target, 0)) return false; - + playerOldName = target->GetName(); } else @@ -345,7 +345,7 @@ public: handler->SetSentErrorMessage(true); return false; } - + if (WorldSession* session = handler->GetSession()) { if (!session->HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newName)) diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index 81608ebd458..6b8ce7732c5 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -518,7 +518,7 @@ public: uint32 copp = (money % GOLD) % SILVER; std::string receiverStr = handler->playerLink(receiver); std::string senderStr = handler->playerLink(sender); - handler->PSendSysMessage(LANG_LIST_MAIL_INFO_1 , messageId, subject.c_str(),gold, silv, copp); + handler->PSendSysMessage(LANG_LIST_MAIL_INFO_1, messageId, subject.c_str(), gold, silv, copp); handler->PSendSysMessage(LANG_LIST_MAIL_INFO_2, senderStr.c_str(), senderId, receiverStr.c_str(), receiverId); handler->PSendSysMessage(LANG_LIST_MAIL_INFO_3, TimeToTimestampStr(deliverTime).c_str(), TimeToTimestampStr(expireTime).c_str()); if (hasItem == 1) @@ -541,7 +541,7 @@ public: uint32 item_entry = fields[0].GetUInt32(); uint32 item_count = fields[1].GetUInt32(); QueryResult result4; - result4 = WorldDatabase.PQuery("SELECT name,quality FROM item_template WHERE entry = '%u'", item_entry); + result4 = WorldDatabase.PQuery("SELECT name, quality FROM item_template WHERE entry = '%u'", item_entry); Field* fields1 = result4->Fetch(); std::string item_name = fields1[0].GetString(); int item_quality = fields1[1].GetUInt8(); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 5e4acbb2ba5..f57413344ad 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1473,37 +1473,124 @@ public: return true; } - // show info of player + + /** + * @name Player command: .pinfo + * @date 05/19/2013 + * + * @brief Prints information about a character and it's linked account to the commander + * + * Non-applying information, e.g. a character that is not in gm mode right now or + * that is not banned/muted, is not printed + * + * This can be done either by giving a name or by targeting someone, else, it'll use the commander + * + * @param args name Prints information according to the given name to the commander + * target Prints information on the target to the commander + * none No given args results in printing information on the commander + * + * @return Several pieces of information about the character and the account + **/ + static bool HandlePInfoCommand(ChatHandler* handler, char const* args) { + // Define ALL the player variables! Player* target; uint64 targetGuid; std::string targetName; + // To make sure we get a target, we convert our guid to an omniversal... uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + // ... and make sure we get a target, somehow. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, targetName)) { target = sObjectMgr->GetPlayerByLowGUID(parseGUID); targetGuid = parseGUID; } + // if not, then return false. Which shouldn't happen, now should it ? else if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; - uint32 accId = 0; - uint32 money = 0; - uint32 totalPlayerTime = 0; - uint8 level = 0; - uint32 latency = 0; - uint8 race; - uint8 Class; - int64 muteTime = 0; - int64 banTime = -1; + /* The variables we extract for the command. They are + * default as "does not exist" to prevent problems + * The output is printed in the follow manner: + * + * Player %s %s (guid: %u) - I. LANG_PINFO_PLAYER + * ** GM Mode active, Phase: -1 - II. LANG_PINFO_GM_ACTIVE (if GM) + * ** Banned: (Type, Reason, Time, By) - III. LANG_PINFO_BANNED (if banned) + * ** Muted: (Time, Reason, By) - IV. LANG_PINFO_MUTED (if muted) + * * Account: %s (id: %u), GM Level: %u - V. LANG_PINFO_ACC_ACCOUNT + * * Last Login: %u (Failed Logins: %u) - VI. LANG_PINFO_ACC_LASTLOGIN + * * Uses OS: %s - Latency: %u ms - Email %s - VII. LANG_PINFO_ACC_OS + * * Last IP: %u (Locked: %s) - VIII. LANG_PINFO_ACC_IP + * * Level: %u (%u/%u XP (%u XP left) - IX. LANG_PINFO_CHR_LEVEL + * * Race: %s %s, Class %s - X. LANG_PINFO_CHR_RACE + * * Alive ?: %s - XI. LANG_PINFO_CHR_ALIVE + * * Phase: %s - XII. LANG_PINFO_CHR_PHASE (if not GM) + * * Money: %ug%us%uc - XIII. LANG_PINFO_CHR_MONEY + * * Map: %s, Area: %s - XIV. LANG_PINFO_CHR_MAP + * * Guild: %s (Id: %u) - XV. LANG_PINFO_CHR_GUILD (if in guild) + * ** Rank: %s - XVI. LANG_PINFO_CHR_GUILD_RANK (if in guild) + * ** Note: %s - XVII. LANG_PINFO_CHR_GUILD_NOTE (if in guild and has note) + * ** O. Note: %s - XVIII.LANG_PINFO_CHR_GUILD_ONOTE (if in guild and has officer note) + * * Played time: %s - XIX. LANG_PINFO_CHR_PLAYEDTIME + * * Mails: %u Read/%u Total - XX. LANG_PINFO_CHR_MAILS (if has mails) + * + * Not all of them can be moved to the top. These should + * place the most important ones to the head, though. + * + * For a cleaner overview, I segment each output in Roman numerals + */ + + // Account data print variables + std::string userName = handler->GetTrinityString(LANG_ERROR); + uint32 accId = 0; + uint32 lowguid = GUID_LOPART(targetGuid); + std::string eMail = handler->GetTrinityString(LANG_ERROR); + uint32 security = 0; + std::string lastIp = handler->GetTrinityString(LANG_ERROR); + uint32 locked = 0; + std::string lastLogin = handler->GetTrinityString(LANG_ERROR); + int16 flogin = 0; + uint32 latency = 0; + std::string OS = "None"; + + // Mute data print variables + int64 muteTime = -1; + std::string muteReason = "unknown"; + std::string muteBy = "unknown"; + + // Ban data print variables + int64 banTime = -1; + std::string banType = "None"; + std::string banReason = "Unknown"; + std::string bannedBy = "Unknown"; + + // Character data print variables + uint8 raceid, classid = 0; //RACE_NONE, CLASS_NONE + std::string raceStr, classStr = "None"; + uint8 gender = 0; + int8 locale = handler->GetSessionDbcLocale(); + std::string genderStr = handler->GetTrinityString(LANG_ERROR); + uint32 totalPlayerTime = 0; + uint8 level = 0; + std::string alive = handler->GetTrinityString(LANG_ERROR); + uint32 money = 0; + uint32 xp = 0; + uint32 xptotal = 0; + + // Position data print uint32 mapId; uint32 areaId; - uint32 phase = 0; + uint32 phase; + std::string areaName = "<unknown>"; + std::string zoneName = "<unknown>"; + + // Guild data print is only defined if part of Guild + + // Mail data print is only defined if you have a mail - // get additional information from Player object if (target) { // check online security @@ -1515,11 +1602,13 @@ public: totalPlayerTime = target->GetTotalPlayedTime(); level = target->getLevel(); latency = target->GetSession()->GetLatency(); - race = target->getRace(); - Class = target->getClass(); + raceid = target->getRace(); + classid = target->getClass(); muteTime = target->GetSession()->m_muteTime; mapId = target->GetMapId(); areaId = target->GetAreaId(); + alive = target->isAlive() ? "Yes" : "No"; + gender = target->getGender(); phase = target->GetPhaseMask(); } // get additional information from DB @@ -1529,8 +1618,9 @@ public: if (handler->HasLowerSecurity(NULL, targetGuid)) return false; + // Query informations from the DB PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); - stmt->setUInt32(0, GUID_LOPART(targetGuid)); + stmt->setUInt32(0, lowguid); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -1541,20 +1631,14 @@ public: level = fields[1].GetUInt8(); money = fields[2].GetUInt32(); accId = fields[3].GetUInt32(); - race = fields[4].GetUInt8(); - Class = fields[5].GetUInt8(); + raceid = fields[4].GetUInt8(); + classid = fields[5].GetUInt8(); mapId = fields[6].GetUInt16(); areaId = fields[7].GetUInt16(); + gender = fields[8].GetUInt8(); } - std::string userName = handler->GetTrinityString(LANG_ERROR); - std::string eMail = handler->GetTrinityString(LANG_ERROR); - std::string muteReason = ""; - std::string muteBy = ""; - std::string lastIp = handler->GetTrinityString(LANG_ERROR); - uint32 security = 0; - std::string lastLogin = handler->GetTrinityString(LANG_ERROR); - + // Query the prepared statement for login data PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO); stmt->setInt32(0, int32(realmID)); stmt->setUInt32(1, accId); @@ -1566,23 +1650,25 @@ public: userName = fields[0].GetString(); security = fields[1].GetUInt8(); eMail = fields[2].GetString(); - muteTime = fields[5].GetUInt64(); - muteReason = fields[6].GetString(); - muteBy = fields[7].GetString(); - - if (eMail.empty()) - eMail = "-"; + // Only fetch these fields if commander has sufficient rights AND is online (prevent cheating) + /// @TODO: Add RBAC for "Can query ip and login data" if (!handler->GetSession() || handler->GetSession()->GetSecurity() >= AccountTypes(security)) { lastIp = fields[3].GetString(); lastLogin = fields[4].GetString(); + // For crossplattforming. Quoting ByteConverter.h + /** ByteConverter reverses the byte order. This is used + for cross platform where they have different endians. + */ + uint32 ip = inet_addr(lastIp.c_str()); -#if TRINITY_ENDIAN == BIGENDIAN + #if TRINITY_ENDIAN == BIGENDIAN EndianConvertReverse(ip); -#endif + #endif + // If ip2nation table is populated, it displays the country PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY); stmt->setUInt32(0, ip); if (PreparedQueryResult result2 = LoginDatabase.Query(stmt)) @@ -1593,27 +1679,26 @@ public: lastIp.append(")"); } } - else - { - lastIp = "-"; - lastLogin = "-"; - } + muteTime = fields[5].GetUInt64(); + muteReason = fields[6].GetString(); + muteBy = fields[7].GetString(); + flogin = fields[8].GetInt16(); + locked = fields[9].GetUInt16(); + OS = fields[10].GetString(); } + // Creates a chat link to the character. Returns nameLink std::string nameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_PINFO_ACCOUNT, (target ? "" : handler->GetTrinityString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGuid), userName.c_str(), accId, eMail.c_str(), security, lastIp.c_str(), lastLogin.c_str(), latency); - - std::string bannedby = "unknown"; - std::string banreason = ""; - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS); - stmt->setUInt32(0, accId); - PreparedQueryResult result2 = LoginDatabase.Query(stmt); + // Returns banType, banTime, bannedBy, banreason + PreparedStatement* stmt2 = LoginDatabase.GetPreparedStatement(LOGIN_SEL_PINFO_BANS); + stmt2->setUInt32(0, accId); + PreparedQueryResult result2 = LoginDatabase.Query(stmt2); if (!result2) { + banType = "Character"; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); - stmt->setUInt32(0, GUID_LOPART(targetGuid)); + stmt->setUInt32(0, lowguid); result2 = CharacterDatabase.Query(stmt); } @@ -1621,98 +1706,83 @@ public: { Field* fields = result2->Fetch(); banTime = int64(fields[1].GetUInt64() ? 0 : fields[0].GetUInt32()); - bannedby = fields[2].GetString(); - banreason = fields[3].GetString(); + bannedBy = fields[2].GetString(); + banReason = fields[3].GetString(); } - if (muteTime > 0) - handler->PSendSysMessage(LANG_PINFO_MUTE, secsToTimeString(muteTime - time(NULL), true).c_str(), muteBy.c_str(), muteReason.c_str()); + // Can be used to query data from World database + stmt2 = WorldDatabase.GetPreparedStatement(WORLD_SEL_REQ_XP); + stmt2->setUInt8(0, level); + PreparedQueryResult result3 = WorldDatabase.Query(stmt2); + if (result3) + { + Field* fields = result3->Fetch(); + xptotal = fields[0].GetUInt32(); + } + + // Can be used to query data from Characters database + stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP); + stmt2->setUInt32(0, lowguid); + PreparedQueryResult result4 = CharacterDatabase.Query(stmt2); + + if (result4) + { + Field* fields = result4->Fetch(); + xp = fields[0].GetUInt32(); + } + + // Initiate output + // Output I. LANG_PINFO_PLAYER + handler->PSendSysMessage(LANG_PINFO_PLAYER, target ? "" : handler->GetTrinityString(LANG_OFFLINE), nameLink.c_str(), lowguid, eMail); + + // Output II. LANG_PINFO_GM_ACTIVE + if (target && target->isGameMaster()) + handler->PSendSysMessage(LANG_PINFO_GM_ACTIVE); + + // Output III. LANG_PINFO_BANNED if ban exists and is applied if (banTime >= 0) - handler->PSendSysMessage(LANG_PINFO_BAN, banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", bannedby.c_str(), banreason.c_str()); - - std::string raceStr, ClassStr; - switch (race) - { - case RACE_HUMAN: - raceStr = "Human"; - break; - case RACE_ORC: - raceStr = "Orc"; - break; - case RACE_DWARF: - raceStr = "Dwarf"; - break; - case RACE_NIGHTELF: - raceStr = "Night Elf"; - break; - case RACE_UNDEAD_PLAYER: - raceStr = "Undead"; - break; - case RACE_TAUREN: - raceStr = "Tauren"; - break; - case RACE_GNOME: - raceStr = "Gnome"; - break; - case RACE_TROLL: - raceStr = "Troll"; - break; - case RACE_BLOODELF: - raceStr = "Blood Elf"; - break; - case RACE_DRAENEI: - raceStr = "Draenei"; - break; - } - - switch (Class) - { - case CLASS_WARRIOR: - ClassStr = "Warrior"; - break; - case CLASS_PALADIN: - ClassStr = "Paladin"; - break; - case CLASS_HUNTER: - ClassStr = "Hunter"; - break; - case CLASS_ROGUE: - ClassStr = "Rogue"; - break; - case CLASS_PRIEST: - ClassStr = "Priest"; - break; - case CLASS_DEATH_KNIGHT: - ClassStr = "Death Knight"; - break; - case CLASS_SHAMAN: - ClassStr = "Shaman"; - break; - case CLASS_MAGE: - ClassStr = "Mage"; - break; - case CLASS_WARLOCK: - ClassStr = "Warlock"; - break; - case CLASS_DRUID: - ClassStr = "Druid"; - break; - } - - std::string timeStr = secsToTimeString(totalPlayerTime, true, true); - uint32 gold = money /GOLD; - uint32 silv = (money % GOLD) / SILVER; - uint32 copp = (money % GOLD) % SILVER; - handler->PSendSysMessage(LANG_PINFO_LEVEL, raceStr.c_str(), ClassStr.c_str(), timeStr.c_str(), level, gold, silv, copp); - - // Add map, zone, subzone and phase to output - int locale = handler->GetSessionDbcLocale(); - std::string areaName = "<unknown>"; - std::string zoneName = ""; + handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banTime > 0 ? secsToTimeString(banTime - time(NULL), true).c_str() : "permanently", banReason.c_str(), bannedBy.c_str()); - MapEntry const* map = sMapStore.LookupEntry(mapId); + // Output IV. LANG_PINFO_MUTED if mute is applied + if (muteTime > 0) + handler->PSendSysMessage(LANG_PINFO_MUTED, secsToTimeString(muteTime - time(NULL), true).c_str(), muteReason.c_str(), muteBy.c_str()); + + // Output V. LANG_PINFO_ACC_ACCOUNT + handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName.c_str(), accId, security); + + // Output VI. LANG_PINFO_ACC_LASTLOGIN + handler->PSendSysMessage(LANG_PINFO_ACC_LASTLOGIN, lastLogin.c_str(), flogin); + + // Output VIII. LANG_PINFO_ACC_OS + handler->PSendSysMessage(LANG_PINFO_ACC_OS, OS.c_str(), latency, eMail.c_str()); + + // Output IX. LANG_PINFO_ACC_IP + handler->PSendSysMessage(LANG_PINFO_ACC_IP, lastIp.c_str(), locked == 0 ? "No" : "Yes"); + + // Output X. LANG_PINFO_CHR_LEVEL + handler->PSendSysMessage(LANG_PINFO_CHR_LEVEL, level, xp, xptotal, (xptotal - xp)); + + // Output XI. LANG_PINFO_CHR_RACE + raceStr = GetRaceName(raceid, locale); + classStr = GetClassName(classid, locale); + handler->PSendSysMessage(LANG_PINFO_CHR_RACE, (gender == 0 ? handler->GetTrinityString(LANG_CHARACTER_GENDER_MALE) : handler->GetTrinityString(LANG_CHARACTER_GENDER_FEMALE)), raceStr.c_str(), classStr.c_str()); + + // Output XII. LANG_PINFO_CHR_ALIVE + handler->PSendSysMessage(LANG_PINFO_CHR_ALIVE, alive.c_str()); + // Output XIII. LANG_PINFO_CHR_PHASE if player is not in GM mode (GM is in every phase) + if (target && !target->isGameMaster()) // IsInWorld() returns false on loadingscreen, so it's more + handler->PSendSysMessage(LANG_PINFO_CHR_PHASE, phase); // precise than just target (safer ?). + // However, as we usually just require a target here, we use target instead. + // Output XIV. LANG_PINFO_CHR_MONEY + uint32 gold = money / GOLD; + uint32 silv = (money % GOLD) / SILVER; + uint32 copp = (money % GOLD) % SILVER; + handler->PSendSysMessage(LANG_PINFO_CHR_MONEY, gold, silv, copp); + + // Position data + MapEntry const* map = sMapStore.LookupEntry(mapId); AreaTableEntry const* area = GetAreaEntryByAreaID(areaId); if (area) { @@ -1724,30 +1794,56 @@ public: } if (target) - { - if (!zoneName.empty()) - handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], zoneName.c_str(), areaName.c_str(), phase); - else - handler->PSendSysMessage(LANG_PINFO_MAP_ONLINE, map->name[locale], areaName.c_str(), "<unknown>", phase); + handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], (!zoneName.empty() ? zoneName.c_str() : "<Unknown>"), (!areaName.empty() ? areaName.c_str() : "<Unknown>")); + + // Guild Data - an own query, because it may not happen. + PreparedStatement* stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED); + stmt3->setUInt32(0, lowguid); + PreparedQueryResult result5 = CharacterDatabase.Query(stmt3); + if (result5) + { + Field* fields = result5->Fetch(); + uint32 guildId = fields[0].GetUInt32(); + std::string guildName = fields[1].GetString(); + std::string guildRank = fields[2].GetString(); + std::string note = fields[3].GetString(); + std::string officeNote = fields[4].GetString(); + + // Output XVII. - XX. + handler->PSendSysMessage(LANG_PINFO_CHR_GUILD, guildName.c_str(), guildId); + handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_RANK, guildRank.c_str()); + // Only output XIX and XX if they are not empty + if (!note.empty()) + handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_NOTE, note.c_str()); + if (!officeNote.empty()) + handler->PSendSysMessage(LANG_PINFO_CHR_GUILD_ONOTE, officeNote.c_str()); } - else - handler->PSendSysMessage(LANG_PINFO_MAP_OFFLINE, map->name[locale], areaName.c_str()); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED); - stmt->setUInt32(0, GUID_LOPART(targetGuid)); + // Output XXI. LANG_PINFO_CHR_PLAYEDTIME + handler->PSendSysMessage(LANG_PINFO_CHR_PLAYEDTIME, (secsToTimeString(totalPlayerTime, true, true)).c_str()); - result = CharacterDatabase.Query(stmt); - if (result) + // Mail Data - an own query, because it may or may not be useful. + // SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?" + stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS); + stmt3->setUInt32(0, lowguid); + PreparedQueryResult result6 = CharacterDatabase.Query(stmt3); + if (result6) { - Field* fields = result->Fetch(); + // Define the variables, so the compiler knows they exist + int rmailint = 0; - uint32 guildId = fields[0].GetUInt32(); - std::string guildName = fields[1].GetString(); - std::string guildRank = fields[2].GetString(); - std::string note = fields[3].GetString(); - std::string officeNote = fields[4].GetString(); + // Fetch the fields - readmail is a SUM(x) and given out as char! Thus... + Field* fields = result6->Fetch(); + const char* readmail = fields[0].GetCString(); + uint64 totalmail = fields[1].GetUInt64(); + + // ... we have to convert it from Char to int. We can use totalmail as it is + if (readmail) + rmailint = atoi(readmail); - handler->PSendSysMessage(LANG_PINFO_GUILD_INFO, guildName.c_str(), guildId, guildRank.c_str(), note.c_str(), officeNote.c_str()); + // Output XXII. LANG_INFO_CHR_MAILS if at least one mails is given + if (totalmail >= 1) + handler->PSendSysMessage(LANG_PINFO_CHR_MAILS, rmailint, totalmail); } return true; @@ -1785,6 +1881,7 @@ public: return true; } + // mute player for some times static bool HandleMuteCommand(ChatHandler* handler, char const* args) { diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 55b6edbadbe..300b39fc389 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -128,7 +128,7 @@ public: int32 gy = 32 - player->GetPositionY() / SIZE_OF_GRIDS; handler->PSendSysMessage("%03u%02i%02i.mmtile", player->GetMapId(), gy, gx); - handler->PSendSysMessage("gridloc [%i,%i]", gx, gy); + handler->PSendSysMessage("gridloc [%i, %i]", gx, gy); // calculate navmesh tile location dtNavMesh const* navmesh = MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId()); @@ -148,7 +148,7 @@ public: int32 tilex = int32((y - min[0]) / SIZE_OF_GRIDS); int32 tiley = int32((x - min[2]) / SIZE_OF_GRIDS); - handler->PSendSysMessage("Calc [%02i,%02i]", tilex, tiley); + handler->PSendSysMessage("Calc [%02i, %02i]", tilex, tiley); // navmesh poly -> navmesh tile location dtQueryFilter filter = dtQueryFilter(); @@ -156,16 +156,16 @@ public: navmeshquery->findNearestPoly(location, extents, &filter, &polyRef, NULL); if (polyRef == INVALID_POLYREF) - handler->PSendSysMessage("Dt [??,??] (invalid poly, probably no tile loaded)"); + handler->PSendSysMessage("Dt [??, ??] (invalid poly, probably no tile loaded)"); else { dtMeshTile const* tile; dtPoly const* poly; navmesh->getTileAndPolyByRef(polyRef, &tile, &poly); if (tile) - handler->PSendSysMessage("Dt [%02i,%02i]", tile->header->x, tile->header->y); + handler->PSendSysMessage("Dt [%02i, %02i]", tile->header->x, tile->header->y); else - handler->PSendSysMessage("Dt [??,??] (no tile loaded)"); + handler->PSendSysMessage("Dt [??, ??] (no tile loaded)"); } return true; @@ -190,7 +190,7 @@ public: if (!tile || !tile->header) continue; - handler->PSendSysMessage("[%02i,%02i]", tile->header->x, tile->header->y); + handler->PSendSysMessage("[%02i, %02i]", tile->header->x, tile->header->y); } return true; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 97eeb385e15..6fe0934191e 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -222,7 +222,7 @@ class boss_arlokk : public CreatureScript break; case EVENT_MARK_OF_ARLOKK: { - Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1,3), 0.0f, false, -SPELL_MARK_OF_ARLOKK); + Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, urand(1, 3), 0.0f, false, -SPELL_MARK_OF_ARLOKK); if (!target) target = me->getVictim(); if (target) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index bd7b7a8798c..9a94ab02348 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -409,7 +409,7 @@ class spell_threatening_gaze : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - if(Unit* target = GetTarget()) + if (Unit* target = GetTarget()) if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEATH) caster->CastSpell(target, SPELL_WATCH_CHARGE); } diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index c523cfba952..6458047bb60 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -154,14 +154,14 @@ struct DialogueEntry class DialogueHelper { public: - // The array MUST be terminated by {0,0,0} + // The array MUST be terminated by {0, 0, 0} DialogueHelper(DialogueEntry const* dialogueArray) : _dialogueArray(dialogueArray), _currentEntry(NULL), _actionTimer(0), _isFirstSide(true) {} - // The array MUST be terminated by {0,0,0,0,0} + // The array MUST be terminated by {0, 0, 0, 0, 0} /// Function to initialize the dialogue helper for instances. If not used with instances, GetSpeakerByEntry MUST be overwritten to obtain the speakers /// Set if take first entries or second entries @@ -183,7 +183,7 @@ public: if (!found) return; - + DoNextDialogueStep(); } @@ -398,7 +398,7 @@ public: void WaypointReached(uint32 pointId) { - switch(pointId) + switch (pointId) { case 3: Talk(SAY_ENTER_OWL_THICKET); @@ -437,7 +437,7 @@ public: SetEscortPaused(true); DoSummonPriestess(); Talk(SAY_RANSHALLA_ALTAR_2); - events.ScheduleEvent(EVENT_RESUME,2000); + events.ScheduleEvent(EVENT_RESUME, 2000); break; case 44: // Stop the escort and turn towards the altar diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index bd8afded346..090ebbca69d 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -148,10 +148,10 @@ class npc_announcer_toc10 : public CreatureScript break; } } - + if (i >= NUM_MESSAGES) return false; - + player->SEND_GOSSIP_MENU(_GossipMessage[i].msgnum, creature->GetGUID()); return true; } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index 64a315eb465..105b4757066 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -95,7 +95,7 @@ enum Yells SAY_STORMWIND_ROLEPLAY_2 = 1, SAY_STORMWIND_ROLEPLAY_3 = 2, SAY_STORMWIND_ROLEPLAY_6 = 3, - + // King Llane SAY_STORMWIND_ROLEPLAY_5 = 0, }; @@ -440,7 +440,7 @@ class boss_voice_of_yogg_saron : public CreatureScript void EnterEvadeMode() { BossAI::EnterEvadeMode(); - + for (uint8 i = DATA_SARA; i <= DATA_MIMIRON_YS; ++i) if (Creature* creature = ObjectAccessor::GetCreature(*me, instance->GetData64(i))) creature->AI()->EnterEvadeMode(); @@ -448,7 +448,7 @@ class boss_voice_of_yogg_saron : public CreatureScript // not sure, spoken by Sara (sound), regarding to wowwiki Voice whispers it Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player *player = itr->getSource()) + if (Player* player = itr->getSource()) { if (events.IsInPhase(PHASE_ONE)) Talk(WHISPER_VOICE_PHASE_1_WIPE, player->GetGUID()); @@ -670,16 +670,16 @@ class boss_sara : public CreatureScript std::map<uint64, uint64>::const_iterator itr = _linkData.find(guid); if (itr != _linkData.end()) return itr->second; - + return 0; } - + void SetLinkBetween(uint64 player1, uint64 player2) { _linkData[player1] = player2; _linkData[player2] = player1; } - + // called once for each target on aura remove void RemoveLinkFrom(uint64 player1) { @@ -932,7 +932,7 @@ class boss_yogg_saron : public CreatureScript Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (Player *player = itr->getSource()) + if (Player* player = itr->getSource()) { player->RemoveAurasDueToSpell(SPELL_SANITY); player->RemoveAurasDueToSpell(SPELL_INSANE); @@ -1069,7 +1069,7 @@ class boss_brain_of_yogg_saron : public CreatureScript uint8 illusion = _instance->GetData(DATA_ILLUSION); if (++_tentaclesKilled >= (illusion == ICECROWN_ILLUSION ? 9 : 8)) { - sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA); + sCreatureTextMgr->SendChat(me, EMOTE_BRAIN_ILLUSION_SHATTERED, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_AREA); _summons.DespawnAll(); DoCastAOE(SPELL_SHATTERED_ILLUSION, true); _instance->HandleGameObject(_instance->GetData64(GO_BRAIN_ROOM_DOOR_1 + illusion), true); @@ -1522,7 +1522,7 @@ class npc_observation_ring_keeper : public CreatureScript DoCast(SPELL_TELEPORT); Talk(SAY_KEEPER_CHOSEN_1, player->GetGUID()); Talk(SAY_KEEPER_CHOSEN_2, player->GetGUID()); - + switch (me->GetEntry()) { case NPC_FREYA_OBSERVATION_RING: @@ -2024,12 +2024,6 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830 PrepareSpellScript(spell_yogg_saron_malady_of_the_mind_SpellScript); - bool Load() - { - _applyHandlers = GetSpellInfo()->Id == SPELL_MALADY_OF_THE_MIND; - return true; - } - void FilterTargets(std::list<WorldObject*>& targets) { targets.remove_if(HighSanityTargetSelector()); @@ -2038,7 +2032,7 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830 void Register() { - if (_applyHandlers) + if (m_scriptSpellId == SPELL_MALADY_OF_THE_MIND) { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_malady_of_the_mind_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_malady_of_the_mind_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); @@ -2047,8 +2041,6 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830 OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_malady_of_the_mind_SpellScript::RemoveSanity, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT); } - - bool _applyHandlers; }; class spell_yogg_saron_malady_of_the_mind_AuraScript : public AuraScript @@ -2093,16 +2085,16 @@ class spell_yogg_saron_malady_of_the_mind : public SpellScriptLoader // 63830 return new spell_yogg_saron_malady_of_the_mind_AuraScript(); } }; - + class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 { public: spell_yogg_saron_brain_link() : SpellScriptLoader("spell_yogg_saron_brain_link") { } - + class spell_yogg_saron_brain_link_SpellScript : public SpellScript { PrepareSpellScript(spell_yogg_saron_brain_link_SpellScript); - + void FilterTargets(std::list<WorldObject*>& targets) { targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_ILLUSION_ROOM)); @@ -2112,17 +2104,17 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 targets.clear(); return; } - + if (SaraAI* ai = CAST_AI(SaraAI, GetCaster()->GetAI())) ai->SetLinkBetween(targets.front()->GetGUID(), targets.back()->GetGUID()); } - + void Register() { OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_yogg_saron_brain_link_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); } }; - + class spell_yogg_saron_brain_link_AuraScript : public AuraScript { PrepareAuraScript(spell_yogg_saron_brain_link_AuraScript); @@ -2135,13 +2127,13 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 return false; return true; } - + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* caster = GetCaster(); if (!caster) return; - + if (SaraAI* ai = CAST_AI(SaraAI, caster->GetAI())) { if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) @@ -2156,36 +2148,36 @@ class spell_yogg_saron_brain_link : public SpellScriptLoader // 63802 } } } - + void DummyTick(AuraEffect const* aurEff) { Unit* caster = GetCaster(); if (!caster) return; - + SaraAI* ai = CAST_AI(SaraAI, caster->GetAI()); if (!ai) return; - + Player* linked = ObjectAccessor::GetPlayer(*GetTarget(), ai->GetLinkedPlayerGUID(GetTarget()->GetGUID())); if (!linked) return; - + GetTarget()->CastSpell(linked, (GetTarget()->GetDistance(linked) > (float)aurEff->GetAmount()) ? SPELL_BRAIN_LINK_DAMAGE : SPELL_BRAIN_LINK_NO_DAMAGE, true); } - + void Register() { OnEffectPeriodic += AuraEffectPeriodicFn(spell_yogg_saron_brain_link_AuraScript::DummyTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); OnEffectRemove += AuraEffectRemoveFn(spell_yogg_saron_brain_link_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; - + SpellScript* GetSpellScript() const { return new spell_yogg_saron_brain_link_SpellScript(); } - + AuraScript* GetAuraScript() const { return new spell_yogg_saron_brain_link_AuraScript(); @@ -2220,7 +2212,7 @@ class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030 { public: spell_yogg_saron_boil_ominously() : SpellScriptLoader("spell_yogg_saron_boil_ominously") { } - + class spell_yogg_saron_boil_ominously_SpellScript : public SpellScript { PrepareSpellScript(spell_yogg_saron_boil_ominously_SpellScript); @@ -2231,7 +2223,7 @@ class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030 return false; return true; } - + void HandleDummy(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) @@ -2243,7 +2235,7 @@ class spell_yogg_saron_boil_ominously : public SpellScriptLoader // 63030 GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_GUARDIAN_1, true); } } - + void Register() { OnEffectHitTarget += SpellEffectFn(spell_yogg_saron_boil_ominously_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index 86c0c4888ed..612be3b71e8 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -21,7 +21,7 @@ #include "ObjectMgr.h" #define UlduarScriptName "instance_ulduar" -extern Position const ObservationRingKeepersPos[4]; +extern Position const ObservationRingKeepersPos[4]; extern Position const YSKeepersPos[4]; extern Position const AlgalonLandPos; @@ -149,7 +149,7 @@ enum UlduarNPCs NPC_SANITY_WELL = 33991, NPC_DESCEND_INTO_MADNESS = 34072, NPC_MARKED_IMMORTAL_GUARDIAN = 36064, - + // Algalon the Observer NPC_BRANN_BRONZBEARD_ALG = 34064, NPC_AZEROTH = 34246, diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 84829cdae12..8e726c10fca 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -115,10 +115,10 @@ public: /// There is a good reason to store them like this, we are going to shuffle the order. for (uint32 i = PHASE_FRENZIED_WORGEN; i < PHASE_GORTOK_PALEHOOF; ++i) Sequence[i] = Phase(i); - + /// This ensures a random order and only executes each phase once. std::random_shuffle(Sequence, Sequence + PHASE_GORTOK_PALEHOOF); - + uiArcingSmashTimer = 15000; uiImpaleTimer = 12000; uiWhiteringRoarTimer = 10000; diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 60f641d9054..c60f4f07821 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3531,7 +3531,7 @@ class spell_gen_orc_disguise : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || + if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) return false; return true; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 2e6ab10b087..4f8a32aa950 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -421,8 +421,12 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME, "SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHAR_DEL_INFO, "SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID, "SELECT guid FROM characters WHERE account = ?", CONNECTION_SYNCH); - PrepareStatement(CHAR_SEL_CHAR_PINFO, "SELECT totaltime, level, money, account, race, class, map, zone FROM characters WHERE guid = ?", CONNECTION_SYNCH); + PrepareStatement(CHAR_SEL_CHAR_PINFO, "SELECT totaltime, level, money, account, race, class, map, zone, gender FROM characters WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_PINFO_BANS, "SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned WHERE guid = ? AND active ORDER BY bandate ASC LIMIT 1", CONNECTION_SYNCH); + //0: lowGUID + PrepareStatement(CHAR_SEL_PINFO_MAILS, "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?", CONNECTION_SYNCH); + //0: lowGUID + PrepareStatement(CHAR_SEL_PINFO_XP, "SELECT xp FROM characters WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHAR_HOMEBIND, "SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHAR_GUID_NAME_BY_ACC, "SELECT guid, name FROM characters WHERE account = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_POOL_QUEST_SAVE, "SELECT quest_id FROM pool_quest_save WHERE pool_id = ?", CONNECTION_SYNCH); diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 59ac15978b6..362bb3545df 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -365,6 +365,8 @@ enum CharacterDatabaseStatements CHAR_SEL_CHARS_BY_ACCOUNT_ID, CHAR_SEL_CHAR_PINFO, + CHAR_SEL_PINFO_XP, + CHAR_SEL_PINFO_MAILS, CHAR_SEL_PINFO_BANS, CHAR_SEL_CHAR_HOMEBIND, CHAR_SEL_CHAR_GUID_NAME_BY_ACC, diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 0118f637205..6113dd61d70 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -79,7 +79,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_GET_USERNAME_BY_ID, "SELECT username FROM account WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_CHECK_PASSWORD, "SELECT 1 FROM account WHERE id = ? AND sha_pass_hash = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_CHECK_PASSWORD_BY_NAME, "SELECT 1 FROM account WHERE username = ? AND sha_pass_hash = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_SEL_PINFO, "SELECT a.username, aa.gmlevel, a.email, a.last_ip, DATE_FORMAT(a.last_login, '%Y-%m-%d %T'), a.mutetime, a.mutereason, a.muteby FROM account a LEFT JOIN account_access aa ON (a.id = aa.id AND (aa.RealmID = ? OR aa.RealmID = -1)) WHERE a.id = ?", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_PINFO, "SELECT a.username, aa.gmlevel, a.email, a.last_ip, DATE_FORMAT(a.last_login, '%Y-%m-%d %T'), a.mutetime, a.mutereason, a.muteby, a.failed_logins, a.locked, a.OS FROM account a LEFT JOIN account_access aa ON (a.id = aa.id AND (aa.RealmID = ? OR aa.RealmID = -1)) WHERE a.id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_PINFO_BANS, "SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned WHERE id = ? AND active ORDER BY bandate ASC LIMIT 1", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_GM_ACCOUNTS, "SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= ? AND (aa.realmid = -1 OR aa.realmid = ?)", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_INFO, "SELECT a.username, a.last_ip, aa.gmlevel, a.expansion FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.id = ?", CONNECTION_SYNCH); diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index fa7818d2dca..a36023a23b0 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -91,4 +91,6 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_INS_DISABLES, "INSERT INTO disables (entry, sourceType, flags, comment) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_SEL_DISABLES, "SELECT entry FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_DISABLES, "DELETE FROM disables WHERE entry = ? AND sourceType = ?", CONNECTION_ASYNC); + // 0: uint8 + PrepareStatement(WORLD_SEL_REQ_XP, "SELECT xp_for_next_level FROM player_xp_for_level WHERE lvl = ?", CONNECTION_SYNCH); } diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index d8c3c69dbba..171627bb83a 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -112,6 +112,7 @@ enum WorldDatabaseStatements WORLD_SEL_DISABLES, WORLD_INS_DISABLES, WORLD_DEL_DISABLES, + WORLD_SEL_REQ_XP, MAX_WORLDDATABASE_STATEMENTS }; diff --git a/src/server/shared/Debugging/Errors.cpp b/src/server/shared/Debugging/Errors.cpp index 877d7554c43..1bfe8c8e949 100644 --- a/src/server/shared/Debugging/Errors.cpp +++ b/src/server/shared/Debugging/Errors.cpp @@ -24,7 +24,7 @@ namespace Trinity { -void Assert(char const *file, int line, char const *function, char const *message) +void Assert(char const* file, int line, char const* function, char const* message) { ACE_Stack_Trace st; fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", @@ -33,7 +33,7 @@ void Assert(char const *file, int line, char const *function, char const *messag exit(1); } -void Fatal(char const *file, int line, char const *function, char const *message) +void Fatal(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s FATAL ERROR:\n %s\n", file, line, function, message); @@ -42,7 +42,7 @@ void Fatal(char const *file, int line, char const *function, char const *message exit(1); } -void Error(char const *file, int line, char const *function, char const *message) +void Error(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s ERROR:\n %s\n", file, line, function, message); @@ -50,7 +50,7 @@ void Error(char const *file, int line, char const *function, char const *message exit(1); } -void Warning(char const *file, int line, char const *function, char const *message) +void Warning(char const* file, int line, char const* function, char const* message) { fprintf(stderr, "\n%s:%i in %s WARNING:\n %s\n", file, line, function, message); diff --git a/src/server/shared/Debugging/Errors.h b/src/server/shared/Debugging/Errors.h index fa526a4d094..2821ca504e7 100644 --- a/src/server/shared/Debugging/Errors.h +++ b/src/server/shared/Debugging/Errors.h @@ -24,20 +24,20 @@ namespace Trinity { - DECLSPEC_NORETURN void Assert(char const *file, int line, char const *function, char const *message) ATTR_NORETURN; + DECLSPEC_NORETURN void Assert(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; - DECLSPEC_NORETURN void Fatal(char const *file, int line, char const *function, char const *message) ATTR_NORETURN; + DECLSPEC_NORETURN void Fatal(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; - DECLSPEC_NORETURN void Error(char const *file, int line, char const *function, char const *message) ATTR_NORETURN; + DECLSPEC_NORETURN void Error(char const* file, int line, char const* function, char const* message) ATTR_NORETURN; - void Warning(char const *file, int line, char const *function, char const *message); + void Warning(char const* file, int line, char const* function, char const* message); } // namespace Trinity -#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while(0) -#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) -#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) -#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) +#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while (0) +#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) +#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) +#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while (0) #define ASSERT WPAssert diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 302a03dee47..7777842af17 100644 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -37,7 +37,7 @@ class ByteBufferException : public std::exception public: ~ByteBufferException() throw() { } - char const * what() const throw() { return msg_.c_str(); } + char const* what() const throw() { return msg_.c_str(); } protected: std::string & message() throw() { return msg_; } diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 933d545c899..17c9d596568 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -179,6 +179,7 @@ target_link_libraries(worldserver ${MYSQL_LIBRARY} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} ) if( WIN32 ) diff --git a/src/tools/mmaps_generator/Info/readme.txt b/src/tools/mmaps_generator/Info/readme.txt index 8d7c4f9d2e0..ff3f2f43526 100644 --- a/src/tools/mmaps_generator/Info/readme.txt +++ b/src/tools/mmaps_generator/Info/readme.txt @@ -1,5 +1,8 @@ Generator command line args +--threads [#] Max number of threads used by the generator + Default: 3 + --offMeshInput [file.*] Path to file containing off mesh connections data. Format must be: (see offmesh_example.txt) "map_id tile_x,tile_y (start_x start_y start_z) (end_x end_y end_z) size //optional comments" @@ -63,4 +66,4 @@ movement_extractor 0 builds all tiles of map 0 movement_extractor 0 --tile 34,46 -builds only tile 34,46 of map 0 (this is the southern face of blackrock mountain)
\ No newline at end of file +builds only tile 34,46 of map 0 (this is the southern face of blackrock mountain) |